[comp.unix.aux] Novice administrator cron problem

talley@hpuxa.ircc.ohio-state.edu (James T. Talley) (03/07/91)

I suspect that my question falls into the novice sys admin
category, but I thought that I would try it out here before
sending it to one of the heavy traffic unix newsgroups.

The problem is simple -- every job I put into a crontab file
seems to be run twice.  The cron log shows two separate entries
for each job and frequently the second one will give error
messages because the files it wants are busy.  This is on a Mac
IIci with A/UX 2.0.  The cron jobs I've tried are for system
accounting, UUCP (see example below), and simply testing the cron
problem.

So far I have RTFM, consulted the FAQL on comp.unix.questions,
and scanned comp.unix.admin, and tried a local newsgroup.

Any hints would be appreciated.

Thanks

James Talley
talley+@osu.edu

----------
Example crontab entry:
56 * * * * /bin/su uucp -c "/usr/lib/uucp/uudemon.hr > /dev/null"

Example cron log output:
>  CMD: /bin/su uucp -c "/usr/lib/uucp/uudemon.hr > /dev/null"
>  uucp 599 c Wed Feb 27 12:55:58 1991
<  uucp 599 c Wed Feb 27 12:55:59 1991
>  CMD: /bin/su uucp -c "/usr/lib/uucp/uudemon.hr > /dev/null"
>  uucp 605 c Wed Feb 27 12:56:00 1991
<  uucp 605 c Wed Feb 27 12:56:01 1991

alexis@panix.uucp (Alexis Rosen) (03/08/91)

In article <1991Mar6.215758.20177@magnus.ircc.ohio-state.edu> talley@hpuxa.ircc.ohio-state.edu (James T. Talley) writes:
>I suspect that my question falls into the novice sys admin
>category, but I thought that I would try it out here before
>sending it to one of the heavy traffic unix newsgroups.
>
>The problem is simple -- every job I put into a crontab file
>seems to be run twice.  The cron log shows two separate entries
>for each job and frequently the second one will give error
>messages because the files it wants are busy.  This is on a Mac
>IIci with A/UX 2.0.  The cron jobs I've tried are for system
>accounting, UUCP (see example below), and simply testing the cron
>problem.

You may indeed be at fault but you have probably tripped over a bug in A/UX.
In two years I've seen this happen three times, so it's not exactly common.

What's happening is that you've got two copies of cron running. Look-
$ ps -ef |grep cron
    root   125     1  0  Mar  4  ?        0:07 /etc/cron
    root 21856     1  1 15:31:25 ?        0:00 /etc/cron
    root 21858 21850  4 15:31:29 a0       0:00 grep cron

It's possible to fire up a second cron by hand, and it's possible that you
did something like cron <mycrontab at some point, which would also cause this.
It's easy to forget to use "crontab" instead of "cron."

As for a bug report: I haven't got a clue as to how this happens spontaneously
so I have nothing useful to report. I wish it were otherwise.

---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis

talley@hpuxa.ircc.ohio-state.edu (James T. Talley) (03/08/91)

You write:
>What's happening is that you've got two copies of cron running. Look-
>$ ps -ef |grep cron
>    root   125     1  0  Mar  4  ?        0:07 /etc/cron
>    root 21856     1  1 15:31:25 ?        0:00 /etc/cron
>    root 21858 21850  4 15:31:29 a0       0:00 grep cron

Well, mine looks like this -
delphic.root 1 # ps -ef | grep cron
    root   108     1  0  Mar  4  ?        0:06 /etc/cron
    root  2821  2787  4 09:16:22 p0       0:00 grep cron

I've even restarted the system a couple of times.  (It's used for
development right now.  I can pretty much do any thing I want with
it.)

I did some editing of crontab files with a text editor before I read
about the crontab command.  I thought that this might be the problem,
but now there's nothing funny in the /usr/spool/cron/crontabs
directory (crontab, lp, and root are empty, adm is commented out, and
uucp has three lines).  The restarts should have cleared out anything
stored in core.  Unless cron is using info from somewhere else or is
just busted, I can't figure out what is going on.

Thanks for the help,

alexis@panix.uucp (Alexis Rosen) (03/11/91)

In article <1991Mar8.142712.1060@magnus.ircc.ohio-state.edu> talley@hpuxa.ircc.ohio-state.edu (James T. Talley) writes:
>You write:
>>What's happening is that you've got two copies of cron running. Look-
>>$ ps -ef |grep cron
>>    root   125     1  0  Mar  4  ?        0:07 /etc/cron
>>    root 21856     1  1 15:31:25 ?        0:00 /etc/cron
>>    root 21858 21850  4 15:31:29 a0       0:00 grep cron
>
>Well, mine looks like this -
>delphic.root 1 # ps -ef | grep cron
>    root   108     1  0  Mar  4  ?        0:06 /etc/cron
>    root  2821  2787  4 09:16:22 p0       0:00 grep cron
>
>I've even restarted the system a couple of times.  (It's used for
>development right now.  I can pretty much do any thing I want with
>it.)
>
>I did some editing of crontab files with a text editor before I read
>about the crontab command.  I thought that this might be the problem,
>but now there's nothing funny in the /usr/spool/cron/crontabs
>directory (crontab, lp, and root are empty, adm is commented out, and
>uucp has three lines).

Well, that rules out the other possibility (that two files in the crontabs
directory had the same commands).

Is your /etc/inittab set up correctly? You haven't got two invokations of
cron in there? I know, they'd show up with the ps...

What about at jobs?

I think your best bet is to add a few lines to root's crontab. Have it run
a ps -ef just before and just after the uucp cron job is supposed to execute.
That will tell you if there are really two crons then, and perhaps give a
clue as to what's starting up the second cron.

BTW, don't get fooled by the cron job- for a few moments ps will show a newly
created job as being a second cron. (Or something like that. I noticed this
long ago.)

---
Alexis Rosen
Owner/Sysadmin, PANIX Public Access Unix, NY
{cmcl2,apple}!panix!alexis