Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我正在开始编写一个 bash 脚本,该脚本将在一天中的某个时间关闭我的计算机,但我不确定具体需要什么。有人可以发布一个他们将如何做的例子吗?
如果你想每天22:15关机,是root,运行crontab -e,然后添加
crontab -e
15 22 * * * shutdown -h 5
自己在一条线上。
然后保存。每天 22 点 15 分,您会收到系统将在 5 分钟后关闭的警告,而在 5 分钟后,言归正传,它会关闭。如果要中止关闭,shutdown -c请在警告后以 root 身份运行。
shutdown -c