0

I have a mail server in my environment and I never touched it (someone configured it for me at first) since a few days ago when everything stopped working and I was unable to receive any emails. The error was "Kernel Panic" and I had to reboot the server. Someone looked at it and decided that the high uptime caused this. I want to implement a scheduled task to restart the server every 6 months on a Saturday at midnight. Is this possible? Thanks

0

You can configure a cron job for this task.

00 12 01 */6 * bash -c "reboot"

Will reboot the computer every 6 months at 12:00

  • And if I use 24h format I need to run it like this? 00 00 01 */6 * bash -c "reboot" ? – Dominique May 19 '16 at 20:03
  • The second value is given in hours - values 0 to 23 are valid. maybe this cheat sheet will help you understand pc-freak.net/images/… – ap0 May 19 '16 at 20:04
  • Thanks. I'll try to set it up and see. Is there any way to test if it works? Like trigger it somehow? – Dominique May 19 '16 at 20:07
  • Set it to reboot every 10 minutes. This will give you a short time to wait for testing but enough to remove the crontab entry again. Also see murus comment on your question. – ap0 May 19 '16 at 20:08
  • Alright, cheers. I'll try. One more question: */6 this part means that every year in June and December the server will reboot, right? What if I want to reboot it in 6 months starting today? does that work like that (e.g. from when you set it up? or does it calculate the months of the year as I said above?) – Dominique May 19 '16 at 20:15

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.