mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-03-10 03:06:37 +00:00
fhem.pl: Fix shutdown exitvalue for delayedshutdown (Forum #102128)
git-svn-id: https://svn.fhem.de/fhem/trunk@19805 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
parent
2756e7fdb1
commit
8949425c26
17
fhem/fhem.pl
17
fhem/fhem.pl
@ -183,7 +183,7 @@ sub CommandSet($$);
|
||||
sub CommandSetReading($$);
|
||||
sub CommandSetstate($$);
|
||||
sub CommandSetuuid($$);
|
||||
sub CommandShutdown($$;$$);
|
||||
sub CommandShutdown($$;$$$);
|
||||
sub CommandSleep($$);
|
||||
sub CommandTrigger($$);
|
||||
|
||||
@ -1754,9 +1754,9 @@ CancelDelayedShutdown($)
|
||||
}
|
||||
|
||||
sub
|
||||
DelayedShutdown($$)
|
||||
DelayedShutdown($$$)
|
||||
{
|
||||
my ($cl, $param) = @_;
|
||||
my ($cl, $param, $exitValue) = @_;
|
||||
|
||||
return 1 if(keys %delayedShutdowns);
|
||||
foreach my $d (sort keys %defs) {
|
||||
@ -1774,7 +1774,7 @@ DelayedShutdown($$)
|
||||
|
||||
$checkList = sub()
|
||||
{
|
||||
return CommandShutdown($cl, $param, undef, 1)
|
||||
return CommandShutdown($cl, $param, undef, 1, $exitValue)
|
||||
if(!keys %delayedShutdowns || $waitingFor++ >= $maxShutdownDelay);
|
||||
InternalTimer(gettimeofday()+1, $checkList, undef, 0);
|
||||
};
|
||||
@ -1783,17 +1783,16 @@ DelayedShutdown($$)
|
||||
}
|
||||
|
||||
sub
|
||||
CommandShutdown($$;$$)
|
||||
CommandShutdown($$;$$$)
|
||||
{
|
||||
my ($cl, $param, $cmdName, $final) = @_;
|
||||
my $exitValue = 0;
|
||||
my ($cl, $param, $cmdName, $final, $exitValue) = @_;
|
||||
if($param && $param =~ m/^(\d+)$/) {
|
||||
$exitValue = $1;
|
||||
$param = "";
|
||||
}
|
||||
return "Usage: shutdown [restart|exitvalue]"
|
||||
if($param && $param ne "restart");
|
||||
return if(!$final && DelayedShutdown($cl, $param));
|
||||
return if(!$final && DelayedShutdown($cl, $param, $exitValue));
|
||||
|
||||
DoTrigger("global", "SHUTDOWN", 1);
|
||||
Log 0, "Server shutdown";
|
||||
@ -1813,7 +1812,7 @@ CommandShutdown($$;$$)
|
||||
exec('cmd.exe /C net stop fhem & net start fhem');
|
||||
}
|
||||
}
|
||||
exit($exitValue);
|
||||
exit($exitValue ? $exitValue : 0);
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user