mirror of
https://github.com/lucaspalomodevelop/core.git
synced 2026-03-13 00:07:26 +00:00
system: improve RRD collector PID/service handling
PR: https://forum.opnsense.org/index.php?topic=34241.0
This commit is contained in:
parent
038d5b9bcf
commit
fdf46f317c
@ -100,6 +100,9 @@ function rrd_configure($verbose = false, $bootup = false)
|
||||
$downstream = 2500000000;
|
||||
$upstream = 2500000000;
|
||||
|
||||
/* kill off traffic collectors */
|
||||
killbypid('/var/run/updaterrd.pid');
|
||||
|
||||
if (isset($config['rrd']['enable'])) {
|
||||
/* create directory if needed */
|
||||
if (!is_dir($rrddbpath)) {
|
||||
@ -112,8 +115,6 @@ function rrd_configure($verbose = false, $bootup = false)
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "export TERM=dumb\n";
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= 'echo $$ > /var/run/updaterrd.sh.pid';
|
||||
$rrdupdatesh .= "\n";
|
||||
$rrdupdatesh .= "counter=1\n";
|
||||
$rrdupdatesh .= "while [ \"\$counter\" -ne 0 ]\n";
|
||||
$rrdupdatesh .= "do\n";
|
||||
@ -560,17 +561,10 @@ EOD;
|
||||
$fd = fopen("$updaterrdscript", "w");
|
||||
fwrite($fd, "$rrdupdatesh");
|
||||
fclose($fd);
|
||||
|
||||
unset($rrdupdatesh);
|
||||
|
||||
/* kill off traffic collectors */
|
||||
rrd_stop();
|
||||
chmod($updaterrdscrip, 0755);
|
||||
|
||||
/* start traffic collector */
|
||||
mwexec_bg("/bin/sh $updaterrdscript");
|
||||
} else {
|
||||
/* kill off traffic collectors */
|
||||
rrd_stop();
|
||||
mwexecf('/usr/sbin/daemon -f -p %s %s', ['/var/run/updaterrd.pid', $updaterrdscript]);
|
||||
}
|
||||
|
||||
$databases = glob("{$rrddbpath}/*.rrd");
|
||||
@ -609,11 +603,6 @@ function rrd_create_gateway_quality($rrd_file, $unknown = false)
|
||||
}
|
||||
}
|
||||
|
||||
function rrd_stop()
|
||||
{
|
||||
killbypid('/var/run/updaterrd.sh.pid');
|
||||
}
|
||||
|
||||
function rrd_export()
|
||||
{
|
||||
$rrddbpath = '/var/db/rrd';
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user