I'm running Domoticz on a box that the video occasionally glitches on. Rather than hard reset the box when this happens, I'm trying to run a script from a password protected switch to do a graceful restart. I'm running domoticz as me instead of root so the built in restart system button won't help. My script runs from the command line and it appears to run from domoticz, but the system doesn't reboot when domoticz calls it.
Code: Select all
#!/usr/bin/perl
use strict;
use warnings;
my $me = `/usr/bin/whoami`;
my $result = `/usr/bin/sudo /usr/bin/shutdown -r`;
if (!length $result){
$result = 0;
}
`/usr/bin/logger $me`;
`/usr/bin/logger "Result is: $result"`;
exit $result;
When I run it from the command line my syslog has the following output:
Code: Select all
Creating /run/nologin, blocking further logins...
myusername
Result is: 0
And the system reboots.
When run from domoticz this is the syslog output:
And the system never reboots.
Does anyone know what I'm doing wrong?