mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 06:39:11 +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:
parent
6f58b48d35
commit
1bec04a4a3
@ -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.
|
||||
The attribute is checked by the list command, by the FHEMWEB room
|
||||
overview and by xmllist.
|
||||
</li><br/>
|
||||
</li><br>
|
||||
|
||||
<a name="stacktrace"></a>
|
||||
<li>stacktrace<br>
|
||||
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>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- global end - do not remove this line! -->
|
||||
|
@ -1511,13 +1511,20 @@ Die folgenden lokalen Attribute werden von mehreren Geräten verwendet:
|
||||
werden nicht angezeigt, es sei denn das globale Attribut
|
||||
showInternalValues ist gesetzt. Diese Variable wird bei dem list und
|
||||
xmllist Befehl, und bei der FHEMWEB Raumansicht geprüft.
|
||||
</li><br/>
|
||||
</li><br>
|
||||
|
||||
<a name="stacktrace"></a>
|
||||
<li>stacktrace<br>
|
||||
Falls gesetzt (auf 1), schreibt ins FHEM-Log zusätzlich zu jedem
|
||||
"PERL WARNING" den stacktrace.
|
||||
</li><br>
|
||||
|
||||
<a name="restartDelay"></a>
|
||||
<li>restartDelay<br>
|
||||
setzt die Verzögerung beim Neustart mit shutdown restart, die
|
||||
Voreinstellung ist 2 (Sekunden).
|
||||
</li>
|
||||
|
||||
</ul>
|
||||
</ul>
|
||||
<!-- global end - diese Zeile nicht entfernen! -->
|
||||
|
53
fhem/fhem.pl
53
fhem/fhem.pl
@ -247,15 +247,47 @@ $readytimeout = ($^O eq "MSWin32") ? 0.1 : 5.0;
|
||||
|
||||
$modules{Global}{ORDER} = -1;
|
||||
$modules{Global}{LOADED} = 1;
|
||||
$modules{Global}{AttrList} =
|
||||
"archivecmd apiversion archivedir configfile lastinclude logfile " .
|
||||
"modpath nrarchive pidfilename port statefile title " .
|
||||
"mseclog:1,0 version nofork:1,0 language:EN,DE logdir holiday2we " .
|
||||
"autoload_undefined_devices:1,0 dupTimeout latitude longitude altitude " .
|
||||
"backupcmd backupdir backupsymlink backup_before_update " .
|
||||
"exclude_from_update motd restoreDirs uniqueID ".
|
||||
"sendStatistics:onUpdate,manually,never updateInBackground:1,0 ".
|
||||
"showInternalValues:1,0 stacktrace:1,0 ";
|
||||
no warnings 'qw';
|
||||
my @globalAttrList = qw(
|
||||
altitude
|
||||
apiversion
|
||||
archivecmd
|
||||
archivedir
|
||||
autoload_undefined_devices:1,0
|
||||
backup_before_update
|
||||
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";
|
||||
|
||||
use vars qw($readingFnAttributes);
|
||||
@ -1433,7 +1465,8 @@ CommandShutdown($$)
|
||||
unlink($attr{global}{pidfilename}) if($attr{global}{pidfilename});
|
||||
if($param && $param eq "restart") {
|
||||
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}) {
|
||||
# use the OS SCM to stop and start the service
|
||||
exec('cmd.exe /C net stop fhem & net start fhem');
|
||||
|
Loading…
Reference in New Issue
Block a user