CRON is a unix, solaris utility that allows tasks to be automatically run in the background at regular intervals by the cron daemon. These tasks are often termed as cron jobs in unix , solaris. Crontab (CRON Table) is a file which contains the schedule of cron entries to be run and at specified times.
Put this script at /etc/crontad
00 3 * * * root /sbin/reboot
------------------------------------------
Other way
------------------------------------------
Cron is the process for executing commands at a scheduled time.
Crontab is the facility to schedule cron jobs.
Cron jobs can be run by any user, but because you want to reboot, you'll need to do this as root.
Edit the cron table:
# crontab -e
Now you are in vi, editing the cron table. Add a line like:
0 1 * * * shutdown -r now >/dev/null
This command says, when the minute is 0 and the hour is 1, execute the command "shutdown -r now"
and send any standard output to /dev/null (which cause the output to be thrown away).
If you wanted this to happen on only Monday and Friday, you'd change one of the asterisks
(first one I believe) to 1,5 (sunday is 0). Do a man on crontab for more details.
No comments:
Post a Comment