请教:phshutdown(phab中按键关机)

不好意思又来麻烦大家 :blush:
现在我在我的程序中想加两个按键(photon)
其中一个用来重启机器
另外一个用来关闭机器
但是phshutdown要人为的确定
不知道有什么方法可以不用认为的确定而直接实现那?
非常感谢

直接用 /bin/shutdown 不行吗?

shutdown 好像是重启机器,请问关闭机器是什么命令啊

shutdown不是重启啊。看下面:

$ use shutdown
shutdown - shutdown the system (Neutrino)

shutdown [options]
Options:
-S type Shutdown type. Type: system|reboot (default:reboot).
-f Fast shutdown.
-n node Node to shutdown. Default is current node.
-b Shutdown but do not reboot. May not be used with -n node.
-q Quiet.
-v Verbose.

所以shutdown -b就不重启了。

但是“关闭机器”的意思是不是把电源关掉的意思啊?这个比较复杂,简单说是没有统一解。不同的主板,有的支持APEC,有的不支持,不是所有的都可以用软件“关闭机器”的。

我试了一下,没有达到效果呢.
#shutdown 重启了
下面3个
#shutdown -S system
#shutdown -f
#shutdown -b
不是重启,就是死在了 login:处,鼠标键盘 numlock键都没有响应。这是怎么回事啊,跟我设置了自动登陆有关系吗,谢谢.