2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-04-28 23:14:10 +00:00

fhem.pl: add restartDelay (Forum #36373)

git-svn-id: https://svn.fhem.de/fhem/trunk@8448 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2015-04-17 16:14:45 +00:00
parent 6f58b48d35
commit 1bec04a4a3
3 changed files with 58 additions and 12 deletions

View File

@ -1417,12 +1417,18 @@ The following local attributes are used by a wider range of devices:
hidden, and will only be visible, if this attribute is set to 1. hidden, and will only be visible, if this attribute is set to 1.
The attribute is checked by the list command, by the FHEMWEB room The attribute is checked by the list command, by the FHEMWEB room
overview and by xmllist. overview and by xmllist.
</li><br/> </li><br>
<a name="stacktrace"></a> <a name="stacktrace"></a>
<li>stacktrace<br> <li>stacktrace<br>
if set (to 1), dump a stacktrace to the log for each "PERL WARNING". if set (to 1), dump a stacktrace to the log for each "PERL WARNING".
</li><br>
<a name="restartDelay"></a>
<li>restartDelay<br>
set the delay for shutdown restart, default is 2 (seconds).
</li> </li>
</ul> </ul>
</ul> </ul>
<!-- global end - do not remove this line! --> <!-- global end - do not remove this line! -->

View File

@ -1511,13 +1511,20 @@ Die folgenden lokalen Attribute werden von mehreren Ger&auml;ten verwendet:
werden nicht angezeigt, es sei denn das globale Attribut werden nicht angezeigt, es sei denn das globale Attribut
showInternalValues ist gesetzt. Diese Variable wird bei dem list und showInternalValues ist gesetzt. Diese Variable wird bei dem list und
xmllist Befehl, und bei der FHEMWEB Raumansicht gepr&uuml;ft. xmllist Befehl, und bei der FHEMWEB Raumansicht gepr&uuml;ft.
</li><br/> </li><br>
<a name="stacktrace"></a> <a name="stacktrace"></a>
<li>stacktrace<br> <li>stacktrace<br>
Falls gesetzt (auf 1), schreibt ins FHEM-Log zus&auml;tzlich zu jedem Falls gesetzt (auf 1), schreibt ins FHEM-Log zus&auml;tzlich zu jedem
"PERL WARNING" den stacktrace. "PERL WARNING" den stacktrace.
</li><br>
<a name="restartDelay"></a>
<li>restartDelay<br>
setzt die Verz&ouml;gerung beim Neustart mit shutdown restart, die
Voreinstellung ist 2 (Sekunden).
</li> </li>
</ul> </ul>
</ul> </ul>
<!-- global end - diese Zeile nicht entfernen! --> <!-- global end - diese Zeile nicht entfernen! -->

View File

@ -247,15 +247,47 @@ $readytimeout = ($^O eq "MSWin32") ? 0.1 : 5.0;
$modules{Global}{ORDER} = -1; $modules{Global}{ORDER} = -1;
$modules{Global}{LOADED} = 1; $modules{Global}{LOADED} = 1;
$modules{Global}{AttrList} = no warnings 'qw';
"archivecmd apiversion archivedir configfile lastinclude logfile " . my @globalAttrList = qw(
"modpath nrarchive pidfilename port statefile title " . altitude
"mseclog:1,0 version nofork:1,0 language:EN,DE logdir holiday2we " . apiversion
"autoload_undefined_devices:1,0 dupTimeout latitude longitude altitude " . archivecmd
"backupcmd backupdir backupsymlink backup_before_update " . archivedir
"exclude_from_update motd restoreDirs uniqueID ". autoload_undefined_devices:1,0
"sendStatistics:onUpdate,manually,never updateInBackground:1,0 ". backup_before_update
"showInternalValues:1,0 stacktrace:1,0 "; backupcmd
backupdir
backupsymlink
configfile
dupTimeout
exclude_from_update
holiday2we
language:EN,DE
lastinclude
latitude
logdir
logfile
longitude
modpath
motd
mseclog:1,0
nofork:1,0
nrarchive
pidfilename
port
restartDelay
restoreDirs
sendStatistics:onUpdate,manually,never
showInternalValues:1,0
stacktrace:1,0
statefile
title
uniqueID
updateInBackground:1,0
version
);
use warnings 'qw';
$modules{Global}{AttrList} = join(" ", @globalAttrList);
$modules{Global}{AttrFn} = "GlobalAttr"; $modules{Global}{AttrFn} = "GlobalAttr";
use vars qw($readingFnAttributes); use vars qw($readingFnAttributes);
@ -1433,7 +1465,8 @@ CommandShutdown($$)
unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename}); unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename});
if($param && $param eq "restart") { if($param && $param eq "restart") {
if ($^O !~ m/Win/) { if ($^O !~ m/Win/) {
system("(sleep 2; exec $^X $0 $attr{global}{configfile})&"); system("(sleep " . AttrVal("global", "restartDelay", 2) .
"; exec $^X $0 $attr{global}{configfile})&");
} elsif ($winService->{AsAService}) { } elsif ($winService->{AsAService}) {
# use the OS SCM to stop and start the service # use the OS SCM to stop and start the service
exec('cmd.exe /C net stop fhem & net start fhem'); exec('cmd.exe /C net stop fhem & net start fhem');