I want to shut down another computer in my network when shutting down my own.
For that I have created a script that logs into that machine through ssh
and powers it off. (SSH keys are set up, so no need for password.)
#! /bin/sh
ssh user@remote sudo halt
And placed it in /etc/init.d
.
Then I created two symlinks pointing to this file under rc0.d
and rc6.d
called K10haltremote.sh
.
If I call the script manually it works as expected, but when shutting down or rebooting my machine does not have any effect on the remote one.
The only thing I can figure out is that shutdown is too fast, and there is not time for the ssh connection, but it's only a guess.
Any ideas?