I would like to know if there is a easy way to schedule an application such as OpenVPN running on a Linux server to automatically restart every 4 days at a specific time.
Thanks
|
I would like to know if there is a easy way to schedule an application such as OpenVPN running on a Linux server to automatically restart every 4 days at a specific time. Thanks | |||
|
feedback
|
|
Use cron. Place a file in /etc/cron.d containing the following line :
| |||||||||
feedback
|
|
See this answer and this one. You can create a
or
You can change "0" to 1, 2, or 3 to affect which day in the four-day cycle is your trigger day. As noted in the first link above, this doesn't take into account leap seconds. Or you can have your script do its thing then queue itself to run again with | |||
|
feedback
|
|
If it really is that important to get every 4 days, run this script on startup (adapt to your local needs):
But you will probably find that your life will be better by restarting it via cron as Dennis suggests. | |||
|
feedback
|
|
I have an application that needs to run every 20 days. To do that I use a script which checks the timestamp of a flag file (creating it if it doesn't exist). If that file was modified less than 20 days ago the script exits. If not, it "touches" the flag file to reset its timestamp to now and calls the application that needs to run. The script is run as a daily cron job. | |||
|
feedback
|