[Newbies] 求帮助_定时关机任务不执行?
Tofloor
poster avatar
xhzqk_189_cn
deepin
2021-04-14 01:35
Author

crontab -e,新增以下一行:

30 21 * * * /sbin/shutdown -h now

结果没有任何反应,

但是:*/2 * * * * date >> ~/time.log  没2分钟执行一次。

Reply Favorite View the author
All Replies
lcw0268
deepin
2021-04-14 03:18
#1

-h不是默认的帮助吗?

Reply View the author
观摩
deepin
2021-04-14 04:19
#2

关机定时任务写在 sudo crontab -e 里面

Reply View the author
zhangqf
deepin
2022-02-15 21:28
#3

在CentOS中直接编辑/etc/crontab,指定root用户定时调用init 0就搞定了定时关机。

可是在深度Linux中却很难,遇到一系列意想不到的问题:

(1)普通用户crontab -e编辑定时任务列表,执行date这样的指令没有问题,说明cron服务运行正常;

(2)加入shutdown -P now指令,也会自动运行,但提示“shutdown not found”;

(3)加入init 0指令,系统提示“权限不足”;

(4)以root用户crontab -e编辑定时任务列表,所有指令均不会运行,进入/var/spool/cron/crontabs目录,看root文件已经被更新,所列任务赫然其中,但就是不会定时运行。

在深度Linux下实现定时关机就真的这么难?!

Reply View the author