如果我想让我的机器明天凌晨2点重新启动别再晚了,明天早上的那一次。我该怎么做?
发布于 2022-04-21 06:06:16
使用shutdown -r和TIME选项:
$ shutdown -r 02:00
Shutdown scheduled for Fri 2022-04-22 02:00:00 CEST, use 'shutdown -c' to cancel.来自man shutdown:
SYNOPSIS
shutdown [OPTIONS...] [TIME] [WALL...]
DESCRIPTION
[...]
The time string may either be in the format "hh:mm" [...] specified in 24h clock format.
Alternatively it may be in the syntax "+m" referring to the specified number of minutes m from now.
OPTIONS
[...]
-r, --reboot
Reboot the machine或者,您可以通过使用at来安排程序的执行:
$ echo "reboot -f" | at 02:00
warning: commands will be executed using /bin/sh
job 1 at Fri Apr 22 02:00:00 2022请参阅计划命令列表及其使用id的atq,使用atrm 从list中删除。
(可能需要安装sudo apt install at)。
注意:at的好处是计划可以重新启动,而计划的shutdown将在02:00之前重新启动时被取消。
https://askubuntu.com/questions/1403450
复制相似问题