EL6 context: cronie-1.4.4-16.el6_8.2.x86_64 cronie-anacron-1.4.4-16.el6_8.2.x86_64 crontabs-1.10-33.el6.noarch
I have some cron.d entries that execute scripts in minute intervals and I'm wondering how could an "official" way look like, to have a condition to not run cron.d entries when cron.daily scripts are running. Sure, I can hack something around file timestamps or so but that feels not so streamlined ...
I'd really appreciate any ideas ...
-- LF
Well, this is anything but elegant, but if your daily occurs at an exact hour and minute you could write two series of per minute cron jobs (a "before' and an "after") avoiding that minute.
Leroy Tennison Network Information/Cyber Security Specialist E: leroy@datavoiceint.com 2220 Bush Dr McKinney, Texas 75070 www.datavoiceint.com This message has been sent on behalf of a company that is part of the Harris Operating Group of Constellation Software Inc. These companies are listed here . If you prefer not to be contacted by Harris Operating Group please notify us . This message is intended exclusively for the individual or entity to which it is addressed. This communication may contain information that is proprietary, privileged or confidential or otherwise legally exempt from disclosure. If you are not the named addressee, you are not authorized to read, print, retain, copy or disseminate this message or any part of it. If you have received this message in error, please notify the sender immediately by e-mail and delete all copies of the message.
________________________________________ From: CentOS centos-bounces@centos.org on behalf of Leon Fauster via CentOS centos@centos.org Sent: Tuesday, February 12, 2019 6:57 AM To: CentOS mailing list Subject: [EXTERNAL] [CentOS] dont run cron.d- when cron.daily-scripts are running
EL6 context: cronie-1.4.4-16.el6_8.2.x86_64 cronie-anacron-1.4.4-16.el6_8.2.x86_64 crontabs-1.10-33.el6.noarch
I have some cron.d entries that execute scripts in minute intervals and I'm wondering how could an "official" way look like, to have a condition to not run cron.d entries when cron.daily scripts are running. Sure, I can hack something around file timestamps or so but that feels not so streamlined ...
I'd really appreciate any ideas ...
-- LF
_______________________________________________ CentOS mailing list CentOS@centos.org https://lists.centos.org/mailman/listinfo/centos
On 2/12/19 4:57 AM, Leon Fauster via CentOS wrote:
I have some cron.d entries that execute scripts in minute intervals and I'm wondering how could an "official" way look like, to have a condition to not run cron.d entries when cron.daily scripts are running. Sure, I can hack something around file timestamps or so but that feels not so streamlined ...
run-parts doesn't look like it produces a lock, so I'd venture that the simplest way would be:
*/5 * * * * root pidof -x run-parts || your-command-here
Am 12.02.2019 um 17:02 schrieb Gordon Messmer gordon.messmer@gmail.com:
On 2/12/19 4:57 AM, Leon Fauster via CentOS wrote:
I have some cron.d entries that execute scripts in minute intervals and I'm wondering how could an "official" way look like, to have a condition to not run cron.d entries when cron.daily scripts are running. Sure, I can hack something around file timestamps or so but that feels not so streamlined ...
run-parts doesn't look like it produces a lock, so I'd venture that the simplest way would be:
*/5 * * * * root pidof -x run-parts || your-command-here
Thats a nice solution! Pragmatic and more accurate than the path I was on. Thanks!
-- LF
On 2/13/19 3:29 AM, Leon Fauster via CentOS wrote:
Am 12.02.2019 um 17:02 schrieb Gordon Messmer gordon.messmer@gmail.com:
*/5 * * * * root pidof -x run-parts || your-command-here
Thats a nice solution! Pragmatic and more accurate than the path I was on. Thanks!
I should have noted that this will avoid starting your scripts if run-parts is running, but it won't prevent run-parts from starting while your script runs. If that's important, then you'll have to modify both your cron jobs and the system crontabs that start run-parts, and use a lock of one sort or another.