Jua*_*món 7 ftp scripts suspend hibernate power-management
有什么方法可以防止脚本暂时挂起/休眠?
我希望屏幕在适当的时候进入省电模式,但计算机不会停止。
Caffeine不允许这样做:它禁用全部或全部禁用。
为什么我要这样做?因为有时我会通过 FTP 从服务器下载大量文件。这些下载可能需要数小时才能完成。
为了防止休眠,创建/var/run/do-not-hibernate:
sudo touch /var/run/do-not-hibernate
Run Code Online (Sandbox Code Playgroud)
该文件/usr/lib/pm-utils/sleep.d/000kernel-change使这项工作。如果您需要禁用挂起,请为此创建一个新文件,例如/etc/pm/sleep.d/000_prevent_suspend_hibernate:
#!/bin/sh
# Prevents the machine from suspending or hibernating when
# the file /var/run/do-not-hibernate-or-suspend exist
case "$1" in
suspend|hibernate)
[ -f /var/run/do-not-hibernate-or-suspend ] && exit 1
;;
esac
Run Code Online (Sandbox Code Playgroud)
使其可执行:
sudo chmod +x /etc/pm/sleep.d/000_prevent_suspend_hibernate
Run Code Online (Sandbox Code Playgroud)
如果您需要防止机器挂起或休眠,请创建一个文件:
sudo touch /var/run/do-not-hibernate-or-suspend
Run Code Online (Sandbox Code Playgroud)
重新启动或删除此文件后,挂起和休眠再次起作用。