Skip to content

Commit

Permalink
add process registration (#5457)
Browse files Browse the repository at this point in the history
* add process registration

* update
  • Loading branch information
xmacan committed Aug 19, 2023
1 parent 24b5c72 commit 96a01b3
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Expand Up @@ -71,6 +71,7 @@ Cacti CHANGELOG
-issue#5452: The default 'bulk_walk_size' is -1 which means a device will never find it's optimal bulk walk size
-issue#5453: Templates without copyright, cleaning SNMP printer package
-issue#5454: Cacti Orphan Graphs Selector missing column 'orphan' in SQL selector
-issue#5457: Enable 'Re-Index All Device Schedule' causes a lot of reindex processes
-feature#5375: Add template for Fortinet firewall and Aruba Instant cluster
-feature#5393: Add template for SNMP printer
-feature#5418: Display device class before package import
Expand Down
14 changes: 14 additions & 0 deletions cli/poller_reindex_hosts.php
Expand Up @@ -152,6 +152,17 @@
print 'WARNING: Do not interrupt this script. Reindexing can take quite some time' . PHP_EOL;
debug("There are '" . cacti_sizeof($data_queries) . "' data queries to run");


/* silently end if the registered process is still running */
if (!$force) {
if (!register_process_start('reindex', 'master', 0, 86400)) {
print "FATAL: Detected an already running process. Use --force to override" . PHP_EOL;
exit(0);
}
}



$i = 1;
$total_start = microtime(true);
if (cacti_sizeof($data_queries)) {
Expand Down Expand Up @@ -195,6 +206,9 @@

$i++;
}

unregister_process('reindex', 'master');

}

function display_version() {
Expand Down

0 comments on commit 96a01b3

Please sign in to comment.