Linux Reboot

Hi Team,

I have a requirement where I need to execute couple of commands once whenever my server is rebooted.For example I used to receive a mail telling there is a planned server reboot for the next day.So I will touch a file

Reb.Lck

.

Once the server reboot complete for the next day(It can be at anytime for the day) I need to remove this file manually.Is there anyway we can automate in such a way that once the server reboot complete for the day remove the Reb.Lck file.

My server version is given below

You may use cron for that:

/etc/cron.d/reboot-cleanup

@reboot root rm -f /path/to/Reb.Lck
2 Likes

Thank you.. So just for my understanding

@reboot root rm -f /path/to/Reb.Lck

, this code will remove the Lck file immediately after the server reboot.

Yes. For exact specification of @reboot read man:crontab(5)