我有一个作业,讲师要我创建一个 bash 脚本,以便在晚上 11 点关闭服务器并在早上 6 点打开它。我可以通过使用来做到这一点sudo shutdown -h 23:00并且它有效。但问题是我不知道如何在早上 6 点自动打开它,我找不到任何可以做到这一点的命令。任何帮助,将不胜感激。
我一直在寻找解决方案,让我的计算机每天在美国东部标准时间凌晨 1 点入睡并在美国东部标准时间下午 6 点醒来。到目前为止,我一直没有成功。
我尝试使用 rtcwake 和 cronjobs 以及这里的脚本:
即使是其他论坛我也无法让它工作。
非常感谢帮助。
Ps 我启用了磁盘加密,所以我无法休眠。
我正在尝试使用例如让我的系统进入睡眠状态
rtcwake -v -m disk -s 60
Run Code Online (Sandbox Code Playgroud)
并收到以下输出
rtcwake: RTC wird als UTC interpretiert
UTC wird verwendet.
delta = 1
tzone = 0
tzname = UTC
systime = 1524206927, (UTC) Fri Apr 20 06:48:47 2018
rtctime = 1524206926, (UTC) Fri Apr 20 06:48:46 2018
Alarm 0, sys_time 1524206927, rtc_time 1524206926, Sekunden 60
rtcwake: wakeup from "disk" using /dev/rtc0 at Fri Apr 20 06:49:47 2018
suspend mode: disk; suspending system
rtcwake: write error
Run Code Online (Sandbox Code Playgroud)
系统似乎开始进入挂起模式,但立即返回。我正在运行 Ubuntu 16.04.4 LTS (GNU/Linux 4.13.0-38-generic x86_64)。是否有任何细节有助于找到问题的根本原因(dmesg 输出、/var/log/syslog,...)? …
如何告诉 Ubuntu 硬件时钟是当地时间?
此命令没有帮助:
timedatectl set-local-rtc 1
Run Code Online (Sandbox Code Playgroud)