Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 45155 - run-crons and /var/spool/cron/lastrun/lock problems
Summary: run-crons and /var/spool/cron/lastrun/lock problems
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: New packages (show other bugs)
Hardware: All Linux
: High normal (vote)
Assignee: Aron Griffis (RETIRED)
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-03-19 12:33 UTC by Mathias Gumz
Modified: 2004-05-24 20:58 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
new run-crons version (run-crons,1.91 KB, text/plain)
2004-03-19 12:34 UTC, Mathias Gumz
Details
new run-crons version (run-crons,1.98 KB, text/plain)
2004-03-19 12:36 UTC, Mathias Gumz
Details
better version with non-racy locking (run-crons,2.51 KB, text/plain)
2004-05-06 15:25 UTC, Aron Griffis (RETIRED)
Details
added credit (run-crons,2.57 KB, text/plain)
2004-05-06 15:27 UTC, Aron Griffis (RETIRED)
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Mathias Gumz 2004-03-19 12:33:15 UTC
with the default cronbase i get a lot of mail when running vixie-cron, created by the /usr/sbin/run-crons program/script. basicly it comes from the lock-mechanism. i did some minor changes to the script and now it runs smoothly and without any probs as far as i can see.

mail output from unfixed cron-messages:

+----------------------------------------------------------
X-Original-To: root                                                                                                            
Delivered-To: root@localhost
From: Cron Daemon <root@localhost>
To: root@localhost
Subject: Cron <root@localhost> test -x /usr/sbin/run-crons && /usr/sbin/run-crons
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
Date: Fri, 19 Mar 2004 21:04:00 +0100 (CET)

cat: /var/spool/cron/lastrun/lock: No such file or directory
+----------------------------------------------------------

i ll attach my version. basic problem is imho that another cron-process comes between the 

[ -f lockfile ]

and the grabbing for the pid out of the lockfile.

regards,
mathias

Reproducible: Always
Steps to Reproduce:
1.
2.
3.
Comment 1 Mathias Gumz 2004-03-19 12:34:05 UTC
Created attachment 27641 [details]
new run-crons version
Comment 2 Mathias Gumz 2004-03-19 12:35:31 UTC
Comment on attachment 27641 [details]
new run-crons version

damn, this is the original :)
Comment 3 Mathias Gumz 2004-03-19 12:36:38 UTC
Created attachment 27642 [details]
new run-crons version
Comment 4 Aron Griffis (RETIRED) gentoo-dev 2004-05-06 15:25:31 UTC
Created attachment 30876 [details]
better version with non-racy locking

I'll get this in once I actually test it
Comment 5 Aron Griffis (RETIRED) gentoo-dev 2004-05-06 15:26:29 UTC
Sorry, I'll make sure to add you to the credits too... My code includes some of your changes.
Comment 6 Aron Griffis (RETIRED) gentoo-dev 2004-05-06 15:27:53 UTC
Created attachment 30877 [details]
added credit
Comment 7 Mathias Gumz 2004-05-06 20:19:09 UTC
works ok so far except for the warning that in line 32 the -lt is syntactilly wrong ... 

((i=0; i < 2; i=i+1))

should do the trick,

regards,
mathias
Comment 8 Duke 2004-05-16 20:18:46 UTC
I'm getting mail with the "kill" usage output:

Usage:                                                                          
  kill pid ...              Send SIGTERM to every process listed.               
  kill signal pid ...       Send a signal to every process listed.              
  kill -s signal pid ...    Send a signal to every process listed.              
  kill -l                   List all signal names.                              
  kill -L                   List all signal names in a nice table.              
  kill -l signal            Convert between signal numbers and names.           

I'm assuming it's because the lockfile doesn't exist, so in run-crons when it gets to the line

if `kill -0 $cronpid >/dev/null 2>&1`

$cronpid is empty, so kill outputs the usage info.  But, shouldn't the line

if test -f /var/spool/cron/lastrun/lock

keep it from getting to that point without a pid?

Is the problem I'm experiencing related to this bug?
Comment 9 Aron Griffis (RETIRED) gentoo-dev 2004-05-24 20:55:37 UTC
Ok, it's in portage as cronbase-0.3.  And yes Duke, this should solve the problem you described.
Comment 10 Duke 2004-05-24 20:58:46 UTC
Thank you!