mirror of
https://github.com/fhem/fhem-mirror.git
synced 2025-01-31 12:49:34 +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:
parent
6eb2962d1e
commit
6bc8caa7cc
@ -1012,13 +1012,14 @@ A line ending with \ will be concatenated with the next one, so long lines
|
|||||||
<a name="rereadcfg"></a>
|
<a name="rereadcfg"></a>
|
||||||
<h3>rereadcfg</h3>
|
<h3>rereadcfg</h3>
|
||||||
<ul>
|
<ul>
|
||||||
<code>rereadcfg</code>
|
<code>rereadcfg [fhem-config-file]</code>
|
||||||
<br><br>
|
<br><br>
|
||||||
Re-read the configuration file.
|
Re-read the configuration file, or the optionally specified file.
|
||||||
Note: The statefile will be saved first, then the config file will be read
|
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
|
(all devices will be initialized again), and at last the statefile will be
|
||||||
reloaded. It triggers upon completion the global:REREADCFG event.
|
reloaded. It triggers upon completion the global:REREADCFG event. All
|
||||||
All existing connections up to the one issuing the rereadcfg will be closed.
|
existing connections up to the one issuing the rereadcfg will be closed.
|
||||||
<br><br>
|
<br><br>
|
||||||
Example:
|
Example:
|
||||||
<ul>
|
<ul>
|
||||||
|
@ -235,7 +235,7 @@ $modules{Global}{AttrFn} = "GlobalAttr";
|
|||||||
"rename" => { Fn=>"CommandRename",
|
"rename" => { Fn=>"CommandRename",
|
||||||
Hlp=>"<old> <new>,rename a definition" },
|
Hlp=>"<old> <new>,rename a definition" },
|
||||||
"rereadcfg" => { Fn=>"CommandRereadCfg",
|
"rereadcfg" => { Fn=>"CommandRereadCfg",
|
||||||
Hlp=>",reread the config file" },
|
Hlp=>"[configfile],read in the config after deleting everything" },
|
||||||
"save" => { Fn=>"CommandSave",
|
"save" => { Fn=>"CommandSave",
|
||||||
Hlp=>"[configfile],write the configfile and the statefile" },
|
Hlp=>"[configfile],write the configfile and the statefile" },
|
||||||
"set" => { Fn=>"CommandSet",
|
"set" => { Fn=>"CommandSet",
|
||||||
@ -882,7 +882,10 @@ CommandRereadCfg($$)
|
|||||||
{
|
{
|
||||||
my ($cl, $param) = @_;
|
my ($cl, $param) = @_;
|
||||||
my $name = $cl->{NAME} if($cl);
|
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();
|
WriteStatefile();
|
||||||
|
|
||||||
$reread_active=1;
|
$reread_active=1;
|
||||||
@ -896,7 +899,6 @@ CommandRereadCfg($$)
|
|||||||
delete $defs{$d};
|
delete $defs{$d};
|
||||||
}
|
}
|
||||||
|
|
||||||
my $cfgfile = $attr{global}{configfile};
|
|
||||||
%comments = ();
|
%comments = ();
|
||||||
%defs = ();
|
%defs = ();
|
||||||
%attr = ();
|
%attr = ();
|
||||||
|
Loading…
Reference in New Issue
Block a user