The system I am working with uses
ssh to remotely connect to a Linux machine. It then executes a single shell command and analyses the output from the shell command.
If I run
reboot, I get exit code
-1, since rebooting of course kills the ssh connection. Any exit code other than 0 makes the system register a failure, thus I have been trying to write a single line command that will reboot and exit the
ssh session gracefully.
The machines in question are very bare bones and the reboot utility does not allow any options so I can't just schedule a reboot for later.
After some thought I tried running
$ sleep 3 && reboot & exit
Which works when I call it manually: the connection closes with error code
0 and 3 seconds later the machine reboots. Great.
But the same command run through our system doesn't actually reboot. It just returns exit code 0 and the reboot never happens.
Why would this be?