0

I need to delete some files on a Linux RHEL 7.8 just after my server reboot every sunday.

I tried to add this line before the ExecStart: ExecStartPre=/usr/bin/rm -f /tmp/xx.txt but it doesn't work.

In fact the files (a size of a few kilobytes) are never delete without any error.

I added this line with vim command, may be systemctl edit --full name_service is better but I don't really now how it work.

May be there is a better way to do that than add it in a service file ?

Any help would be appreciated

2
  • You can put it in a crontab with @reboot. Also, I'd probably make it a script root:root and 700 and invoke the script. The script approach allows a bit of testing. – KevinO Feb 23 at 13:28
  • Hi @KevinO Indeed it's a well solution. I'll try to script this. Thank's – sigds Feb 23 at 14:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.