0

I need my server to reboot after every 5 days of uptime if it is not rebooted and again reboot after exactly 5 days and continue this process consecutively. I would like to know how to do this with cronjob or any other script

Nayantara Jeyaraj
  • 2,624
  • 7
  • 34
  • 63
Neo
  • 1
  • 3

1 Answers1

0

You can use the dow, or Day of Week, part of the crontab syntax, to execute the command on every occurrence of a particular day, using numbers in the form:

0-6 Sunday to Saturday

1-7 Monday to Sunday

Or even shortened word notation such as WED or THU for Wednesday or Thursday

# m h  dom mon dow   command
00 07 * * 5 your-command-here

The example above would run the command at 7:00 am every Friday

Community
  • 1
  • 1
John Gates
  • 96
  • 10