diff --git a/fhem/docs/commandref_frame.html b/fhem/docs/commandref_frame.html
index 30d008572..758a99a31 100644
--- a/fhem/docs/commandref_frame.html
+++ b/fhem/docs/commandref_frame.html
@@ -1233,16 +1233,18 @@ The following local attributes are used by a wider range of devices:
shutdown
- shutdown [restart]
+ shutdown [restart|exitValue]
Shut down the server (after saving the state information
). It triggers the global:SHUTDOWN event. If the optional restart
- parameter is specified, fhem tries to restart itself.
+ parameter is specified, fhem tries to restart itself. exitValue may be
+ important for start scripts.
Example:
shutdown
- shutdown restart
+ shutdown restart
+ shutdown 1
diff --git a/fhem/docs/commandref_frame_DE.html b/fhem/docs/commandref_frame_DE.html
index 73f026e59..fd2748e2b 100644
--- a/fhem/docs/commandref_frame_DE.html
+++ b/fhem/docs/commandref_frame_DE.html
@@ -1309,16 +1309,18 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
shutdown
- shutdown [restart]
+ shutdown [restart|exitValue]
Der Befehl fährt den Server herunter (nach dem sichern aller Gerätestati). Er triggert das global:SHUTDOWN
Ereignis. Mit der optionalen Parameter restart startet FHEM danach neu.
+ exitValue ist bei bestimmten Start-programmen von n&oulm;ten.
Beispiel:
shutdown
- shutdown restart
+ shutdown restart
+ shutdown 1
diff --git a/fhem/fhem.pl b/fhem/fhem.pl
index c78d7184c..01c0e2776 100755
--- a/fhem/fhem.pl
+++ b/fhem/fhem.pl
@@ -364,7 +364,7 @@ $readingFnAttributes = "event-on-change-reading event-on-update-reading ".
"setdefaultattr" => { Fn=>"CommandDefaultAttr",
Hlp=>" ,set attr for following definitions" },
"shutdown"=> { Fn=>"CommandShutdown",
- Hlp=>"[restart],terminate the server" },
+ Hlp=>"[restart|exitValue],terminate the server" },
"sleep" => { Fn=>"CommandSleep",
Hlp=>" [] [quiet],sleep for sec, 3 decimal places" },
"trigger" => { Fn=>"CommandTrigger",
@@ -1496,7 +1496,12 @@ sub
CommandShutdown($$)
{
my ($cl, $param) = @_;
- return "Usage: shutdown [restart]"
+ my $exitValue = 0;
+ if($param && $param =~ m/^(\d+)$/) {
+ $exitValue = $1;
+ $param = "";
+ }
+ return "Usage: shutdown [restart|exitvalue]"
if($param && $param ne "restart");
DoTrigger("global", "SHUTDOWN", 1);
@@ -1517,7 +1522,7 @@ CommandShutdown($$)
exec('cmd.exe /C net stop fhem & net start fhem');
}
}
- exit(0);
+ exit($exitValue);
}