关于crontab的问题(已解决)
发表于 : 2007-01-30 15:55
我新建了一个 allen.cron的文件
内容是
然后在终端里执行了
可是到11点系统没有反应
请诸位大虾指明我的错误 谢谢
在线等 ~~~(已解决)
Solution: 普通用户没有shutdown的权限
我编辑了/etc/crontab
加了一行
时间是24小时制的 只有root有shutdown的权限
这样 每天晚上11点机器就会自动重启一次了
PS:感谢zhan的提示
内容是
代码: 全选
00 11 * * * shutdown -r +2
代码: 全选
crontab allen.cron
请诸位大虾指明我的错误 谢谢
在线等 ~~~(已解决)
Solution: 普通用户没有shutdown的权限
我编辑了/etc/crontab
代码: 全选
# /etc/crontab: system-wide crontab
# Unlike any other crontab you don't have to run the `crontab'
# command to install the new version when you edit this file.
# This file also has a username field, that none of the other crontabs do.
SHELL=/bin/sh
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
# m h dom mon dow user command
17 * * * * root run-parts --report /etc/cron.hourly
25 6 * * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily
47 6 * * 7 root test -x /usr/sbin/anacron || run-parts --report /etc/cron.weekly
52 6 1 * * root test -x /usr/sbin/anacron || run-parts --report /etc/cron.monthly
#
代码: 全选
00 23 * * * root shutdown -r 0
这样 每天晚上11点机器就会自动重启一次了
PS:感谢zhan的提示