我在CentOS中使用gnome。我想要实现的是在指定的时间跨度内完全锁定计算机,比如23:00~7:00。
尝试
有什么想法吗?
答案 0 :(得分:0)
您可以使用gnome-screensaver-command
$ gnome-screensaver-command --help
Usage:
gnome-screensaver-command [OPTION…]
Help Options:
-h, --help Show help options
Application Options:
--exit Causes the screensaver to exit gracefully
-q, --query Query the state of the screensaver
-t, --time Query the length of time the screensaver has been active
-l, --lock Tells the running screensaver process to lock the screen immediately
-a, --activate Turn the screensaver on (blank the screen)
-d, --deactivate If the screensaver is active then deactivate it (un-blank the screen)
-V, --version Version of this application
在你的情况下,cronjob可能就足够了。即。
0 23 * * * DISPLAY=:0 gnome-screensaver-command --lock
0 7 * * * DISPLAY=:0 gnome-screensaver-command --deactivate