2
0
mirror of https://github.com/fhem/fhem-mirror.git synced 2025-01-31 06:39:11 +00:00

rereadcfg argument added

git-svn-id: https://svn.fhem.de/fhem/trunk@1942 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
rudolfkoenig 2012-10-09 19:19:15 +00:00
parent 6eb2962d1e
commit 6bc8caa7cc
2 changed files with 10 additions and 7 deletions

View File

@ -1012,13 +1012,14 @@ A line ending with \ will be concatenated with the next one, so long lines
<a name="rereadcfg"></a>
<h3>rereadcfg</h3>
<ul>
<code>rereadcfg</code>
<code>rereadcfg [fhem-config-file]</code>
<br><br>
Re-read the configuration file.
Note: The statefile will be saved first, then the config file will be read
Re-read the configuration file, or the optionally specified file.
The sequence: the statefile will be saved first, then all devices will be
deleted, then the original config file (or the specified file) will be read
(all devices will be initialized again), and at last the statefile will be
reloaded. It triggers upon completion the global:REREADCFG event.
All existing connections up to the one issuing the rereadcfg will be closed.
reloaded. It triggers upon completion the global:REREADCFG event. All
existing connections up to the one issuing the rereadcfg will be closed.
<br><br>
Example:
<ul>

View File

@ -235,7 +235,7 @@ $modules{Global}{AttrFn} = "GlobalAttr";
"rename" => { Fn=>"CommandRename",
Hlp=>"<old> <new>,rename a definition" },
"rereadcfg" => { Fn=>"CommandRereadCfg",
Hlp=>",reread the config file" },
Hlp=>"[configfile],read in the config after deleting everything" },
"save" => { Fn=>"CommandSave",
Hlp=>"[configfile],write the configfile and the statefile" },
"set" => { Fn=>"CommandSet",
@ -882,7 +882,10 @@ CommandRereadCfg($$)
{
my ($cl, $param) = @_;
my $name = $cl->{NAME} if($cl);
my $cfgfile = ($param ? $param : $attr{global}{configfile});
return "Cannon open $cfgfile: $!" if(! -f $cfgfile);
$attr{global}{configfile} = $cfgfile;
WriteStatefile();
$reread_active=1;
@ -896,7 +899,6 @@ CommandRereadCfg($$)
delete $defs{$d};
}
my $cfgfile = $attr{global}{configfile};
%comments = ();
%defs = ();
%attr = ();