From 74bdaf5585764ab6d058cd5561c8e9d428f4e14d Mon Sep 17 00:00:00 2001 From: "Kyle J. McKay" Date: Thu, 14 Apr 2016 17:13:20 -0700 Subject: [PATCH] jobd.pl: touch ctime of lockfile on each run The default location of the lock file is in /tmp. Some systems periodically clean /tmp of old files (i.e. files that have not been accessed, modified or status changed) periodically. We do not want the lock file to be removed, so touch the ctime to prevent this. The mtime will continue to reflect the time jobd was started while the ctime will reflect the beginning of the most recent run. We do not bother with atime since on some systems changes to atime may be completely ignored. Signed-off-by: Kyle J. McKay --- jobd/jobd.pl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/jobd/jobd.pl b/jobd/jobd.pl index 6223cd8..136a435 100755 --- a/jobd/jobd.pl +++ b/jobd/jobd.pl @@ -436,6 +436,9 @@ sub run_perpetually { $locked = 1; while ($perpetual) { + # touch ctime of lockfile to prevent it from being removed by /tmp cleaning + chmod 0444, $lockfile; + chmod 0644, $lockfile; queue_all(); run_queue(); sleep($restart_delay) if $perpetual; # Let the system breathe for a moment -- 2.11.4.GIT