从我的 ubuntu 关闭远程 Linux 系统

从我的 ubuntu 关闭远程 Linux 系统

我想在关闭电脑时从我的电脑上关闭位于微卡上的远程 Linux 系统。为此,我为 systemd 做了以下服务。当我发送关机/停机命令关闭我的电脑时,它应该会运行,但它不起作用。

[Unit]
Documentation=
Description=Poweroff linux on zynq board
Requires=network.target
Before=shutdown.target reboot.target halt.target

[Service]
Type=oneshot
RemainAfterExit=true
ExecStop=/home/user/bin/zynqdown

[Install]
WantedBy=shutdown.target reboot.target halt.target

zynqdown 脚本只是发送命令:

ssh [email protected] poweroff

启动到 shell 中的 shell 脚本可以正常工作。我查看了不同的论坛,我的服务理论上应该可以工作,但似乎命令是在网络已断时发送的。

您有关于如何修复它的建议吗?谢谢 Claudio

编辑:删除代码中不存在的空白

相关内容