I have a setup where I have runeaudio on a Pi3 in a audio rack (call it Pi1) and use another Pi as just an interface (call this Pi2) in another location. Now to shut down both Pi's at the end of the night I have created a bash script on Pi2 which will SSH to Pi1 tell it to stop playing, clear the playlist and shutdown then run a shutdown command on it self how ever I have ran into an issue.
If I tell Pi1 via ssh to "shutdown now" it will make the script hang on Pi2 and will not complete but if I use "shutdown +1" to delay the shutdown on Pi1 and allow the ssh connection to drop the script will bring back an error and Pi1 will remain on but the script will finish and Pi2 will shut down.
this is the error I get when I try to use anything but "shutdown now" I have also tried using sudo;
Failed to set wall message, ignoring: Unit systemd-logind.service is masked.
Failed to call ScheduleShutdown in logind, proceeding with immediate shutdown: Unit systemd-logind.service is masked.
Any one know how to get this to work your help will be much appreciated?