Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix process control #249

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 13 additions & 3 deletions poller_mactrack.php
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@
/* silently end if the registered process is still running, or process table missing */
if (function_exists('register_process_start')) {
if (!register_process_start('mactrack', 'master', $config['poller_id'], $max_run_duration)) {
intropage_debug('Another Mactrack Process Still Running');
mactrack_debug('Another Mactrack Process Still Running');
exit(0);
}
}
Expand All @@ -121,6 +121,11 @@

if ($collect_frequency == 'disabled') {
echo "WARNING: Mactrack is disabled, exiting\n";

if (function_exists('unregister_process')) {
unregister_process('matrack', 'master', $config['poller_id']);
}

exit(1);
} else {
/* for manual scans, verify if we should run or not */
Expand All @@ -131,6 +136,11 @@

if (time() < (strtotime($start_date) + $max_run_duration) && !$forcerun) {
echo "NOTE: Mactrack currently running and max run duration not eclipsed.\n";

if (function_exists('unregister_process')) {
unregister_process('matrack', 'master', $config['poller_id']);
}

exit(0);
} elseif ($forcerun) {
mactrack_debug('WARNING: Forcing Collection although Collection Appears in Process', true, 'MACTRACK');
Expand Down Expand Up @@ -255,7 +265,7 @@
}

if (function_exists('unregister_process')) {
unregister_process('matrack', 'master', $config['poller_id']);
unregister_process('mactrack', 'master', $config['poller_id']);
}


Expand Down Expand Up @@ -475,7 +485,7 @@ function collect_mactrack_data($start, $site_id = 0) {

mactrack_debug('ARPWATCH: IP, DNS & MAC collection complete with ArpWatch');
} else {
cacti_log("ERROR: cannot open file ArpWatch database '$arp_db'");exit;
cacti_log("ERROR: cannot open file ArpWatch database '$arp_db'");
}
}
}
Expand Down