PDA

View Full Version : Cron daily automated booth


statiic
22nd November 2006, 13:06
I tryed to setup an cron.daily for an automated reboot of my server.

I want it to reboot every day at 05:00 AM local time.

Does anyone know whats the proper script for this?

Or should I do it only once a week?

falko
23rd November 2006, 17:34
Have a look here: http://www.howtoforge.com/forums/showthread.php?t=8239&highlight=shutdown+cron

statiic
23rd November 2006, 18:25
Yes I know that part. But i'm using mandriva an have to create an file within the cron.daily folder. But what must be in the file.

So the cron is already running daily, but now I want to specifiy the time or am I incorrect here?

sjau
23rd November 2006, 23:01
I setup root crons as followed:

1) make a file in /root named cron.txt
2) add stuff there :)

0 5 * * * reboot

3) save the file
4) add it to as cron:

crontab cron.txt

5) check whether it's added

crontab -l

falko
24th November 2006, 17:10
Yes I know that part. But i'm using mandriva an have to create an file within the cron.daily folder. But what must be in the file.

So the cron is already running daily, but now I want to specifiy the time or am I incorrect here?
You could create a file /etc/cron.daily/reboot which looks like this:
#/bin/bash
PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/X11R6/bin

shutdown -r now
exit 0
Don't forget to make it executable:
chmod 755 /etc/cron.daily/reboot