aboutsummaryrefslogtreecommitdiffstats
path: root/Zotlabs/Daemon/Expire.php
diff options
context:
space:
mode:
Diffstat (limited to 'Zotlabs/Daemon/Expire.php')
-rw-r--r--Zotlabs/Daemon/Expire.php13
1 files changed, 12 insertions, 1 deletions
diff --git a/Zotlabs/Daemon/Expire.php b/Zotlabs/Daemon/Expire.php
index 398425861..a688d6f97 100644
--- a/Zotlabs/Daemon/Expire.php
+++ b/Zotlabs/Daemon/Expire.php
@@ -8,6 +8,15 @@ class Expire {
static public function run($argc,$argv){
cli_startup();
+
+ $pid = get_config('expire', 'procid', false);
+ if ($pid && (function_exists('posix_kill') ? posix_kill($pid, 0) : true)) {
+ logger('Expire: procedure already run with pid ' . $pid, LOGGER_DEBUG);
+ return;
+ }
+
+ $pid = getmypid();
+ set_config('expire', 'procid', $pid);
// perform final cleanup on previously delete items
@@ -32,7 +41,7 @@ class Expire {
if (intval(get_config('system', 'optimize_items')))
q("optimize table item");
- logger('expire: start', LOGGER_DEBUG);
+ logger('expire: start with pid ' . $pid, LOGGER_DEBUG);
$site_expire = intval(get_config('system', 'default_expire_days'));
$commented_days = intval(get_config('system','active_expire_days'));
@@ -90,5 +99,7 @@ class Expire {
logger('Expire: sys: done', LOGGER_DEBUG);
}
+
+ del_config('expire', 'procid');
}
}