返回列表 發帖
回復 1# lttliang


    Your may try this

the command to reboot should be something like "shutdown -r now", where -r means to reboot (as opposed to -h which is halt).

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.

TOP

回復 6# lttliang

You can replace with the word to "reboot" in the command line. "Reboot" works in centos but not every linux built.

TOP

返回列表