public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* Re: [gentoo-dev] problems with '/usr/sbin/run-crons' on slow computers
  @ 2004-07-01 17:48 99% ` Drake Wyrm
  0 siblings, 0 replies; 1+ results
From: Drake Wyrm @ 2004-07-01 17:48 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 1966 bytes --]

At 2004-07-01T10:19:25+0200, Alexander Rauth <Alexander.Rauth@promotion-ie.de> wrote:
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
> mkdir -p /var/spool/cron/lastrun
>                                                                                 
> # Make sure its not running multiple instances at once.
> if test -f /var/spool/cron/lastrun/lock
> then
>     cronpid=`cat /var/spool/cron/lastrun/lock`
>     if `kill -0 $cronpid >/dev/null 2>&1`
>     then
>         exit 0
>     fi
> fi
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<                                                                                
> the construction above won't work every time on my K6-200 ....
> Once in two days it happens that the 'lock'-file is gone between the
> 'test -f ....' and 'cronpid=.....' and I receive following error
> message:
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
> cat: /var/spool/cron/lastrun/lock: No such file or directory
> -----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<-----8<
>  
> 
> if I replace 
> cronpid=`cat /var/spool/cron/lastrun/lock`
> with
> cronpid=`cat /var/spool/cron/lastrun/lock 2> /dev/null`
> it solves my problem
> 
> My question is, if there is a nicer way to fix that....
> 
> Alexander
> 
> 
> --
> gentoo-dev@gentoo.org mailing list

It looks as though the Gentoo devs already addressed this issue. You'll
need to update sys-apps/cronbase. The fix looks pretty hairy to me. If
you want to play with this, I'd start with something like:

# Make sure its not running multiple instances at once.
cronpid=`cat /var/spool/cron/lastrun/lock 2>/dev/null`
[ -n "$cronpid" ] && kill -0 $cronpid &>/dev/null && exit 0

Much cleaner!
-- 
Batou: Hey, Major... You ever hear of "human rights"?
Kusanagi: I understand the concept, but I've never seen it in action.
  --Ghost in the Shell

[-- Attachment #2: Type: application/pgp-signature, Size: 197 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2004-07-01  8:19     [gentoo-dev] problems with '/usr/sbin/run-crons' on slow computers Alexander Rauth
2004-07-01 17:48 99% ` Drake Wyrm

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox