Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to use cron and other scheduling utilities on linux/unix?

0 views
Skip to first unread message

Greg Smith

unread,
Feb 2, 1997, 3:00:00 AM2/2/97
to

try 'man crontab' and 'man crond'.

B.A.Mc...@bham.ac.uk

unread,
Feb 3, 1997, 3:00:00 AM2/3/97
to lbliao

In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu (lbliao) writes:
>Subject: Re: How to use cron and other scheduling utilities on
>linux/unix?

RTFM.

--
\\ ( ) No Bullshit! | Email: B.A.Mc...@bham.ac.uk
. _\\__[oo from | Phones: +44 121 471 3789 (home)
.__/ \\ /\@ /~) /~[ /\/[ | +44 121 627 2173 (voice) 2175 (fax)
. l___\\ /~~) /~~[ / [ | PGP-fp: D7 03 2A 4B D8 3A 05 37...
# ll l\\ ~~~~ ~ ~ ~ ~ | http://wcl-l.bham.ac.uk/~bam/
###LL LL\\ (Brian McCauley) | Finger: b...@wcl-rs.bham.ac.uk

Paul Russell

unread,
Feb 4, 1997, 3:00:00 AM2/4/97
to

B.A.Mc...@bham.ac.uk writes:
>
> In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu (lbliao) writes:
> >Subject: Re: How to use cron and other scheduling utilities on
> >linux/unix?
>
> RTFM.

The cron daemon reads files called "crontabs". The crontab command
allows you to read and write these files. The format is pretty
simple, ("man crontab") consisting of five space-separated fields,
followed by a command. The five fields specify when the command is to
be run.

eg:

foobar# crontab -l
# Check system status against baseline.
0 8 * * * /opt/local/etc/showconf.sh
foobar#

This says to run "/opt/local/etc/showconf.sh" at 8 am (mins = 0, hour
= 8, day = any, month = any, day of week = any).

Pretty simple, eh?

For scheduling once-off tasks, rather than regular tasks, see "at".

Paul.
--
Paul.R...@RustCorp.com.au "Engineer? So you drive trains?"
Lies, damned lies, and out-of-date documentation.
Currently contracted to Telstra, Sydney.

Pete Houston

unread,
Feb 5, 1997, 3:00:00 AM2/5/97
to

lbliao <lbl...@alumnae.caltech.edu> wrote in comp.os.linux.setup,comp.os.linux.misc,comp.unix.misc,comp.unix.shell:
#
#
#thanks a lot.
#lbliao
[40 blank lines munched]

Which bits of the man pages are unclear?

Pete


p...@ace.net.au

unread,
Feb 7, 1997, 3:00:00 AM2/7/97
to

I just had a look at m"man crontab" and it appears to be user specific
eg the crontab is attached to a user and presumably that user needs to
be logged in for it to run. Or are contabs just system events
created by specific users that will run anyway?

I am wanting to rotate some logs once a day to stop them getting too
big.

Thanks,
Peter

Icarus Sparry

unread,
Feb 7, 1997, 3:00:00 AM2/7/97
to

In article <32fb5...@news.ace.net.au>, <p...@ace.net.au> wrote:
>I just had a look at "man crontab" and it appears to be user specific

>eg the crontab is attached to a user and presumably that user needs to
>be logged in for it to run. Or are contabs just system events
>created by specific users that will run anyway?

The latter, as a short experiment would have shown.
Icarus

Michael Walters

unread,
Feb 8, 1997, 3:00:00 AM2/8/97
to

B.A.Mc...@bham.ac.uk wrote:
>
> In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu (lbliao) writes:
> >Subject: Re: How to use cron and other scheduling utilities on
> >linux/unix?
>
> RTFM.
>
Wow, there's a helpful and constructive response.

Harold Stevens

unread,
Feb 9, 1997, 3:00:00 AM2/9/97
to

In article <32FD20...@metronet.com>, Michael Walters <mwal...@metronet.com>:
|> B.A.Mc...@bham.ac.uk:
|> >
|> > In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu (lbliao):

|> > >Subject: Re: How to use cron and other scheduling utilities on
|> > >linux/unix?
|> >
|> > RTFM.
|> >
|> Wow, there's a helpful and constructive response.

Just a real gem: the curds and whey in human kindness milk... :)

Yeah, same extraordinary insight Mr. JollyJowls applied to my own
inquiry on the *new* APC UPS product (Back-UPS Office) which does
*not* have the particular tty interfacing mentioned in UPS-HOWTO,
or anything else I could find. A real credit to his species; just
how does he manage to find his way around with all those louts out
there in (*GASP*) His Way, broken down on the Infobahn? :)

Regards, Weird
wy...@ti.com


Roberto Alsina

unread,
Feb 9, 1997, 3:00:00 AM2/9/97
to

In article <32FD20...@metronet.com>, Michael Walters wrote:
>B.A.Mc...@bham.ac.uk wrote:

>>
>> In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu (lbliao) writes:
>> >Subject: Re: How to use cron and other scheduling utilities on
>> >linux/unix?
>>
>> RTFM.
>>
>Wow, there's a helpful and constructive response.

Well, it's quite helpful, and constructive.
Here it is in a more lengthy manner:

Try reading the cron man page: (type "man cron")

If that doesn't make sense, read a book about UNIX systems.

The use of cron and other scheduling utilities is much too complex and long
to be explained in a USENET post.

If the original poster doesn't understand the manuals, he can feel free
to ask me over email.

Is that a polite enough answer?

Gee... now we need to have politically correct people helping others fix
their problems for free, and not even ask that the other person bother
reading the manuals?

Regards

--

("\''/").__..-''"`-. . Roberto Alsina
`9_ 9 ) `-. ( ).`-._.`) ral...@unl.edu.ar
(_Y_.)' ._ ) `._`. " -.-' Centro de Telematica
_..`-'_..-_/ /-'_.' Universidad Nacional del Litoral
(l)-'' ((i).' ((!.' Santa Fe - Argentina


Matthew Mucker

unread,
Feb 10, 1997, 3:00:00 AM2/10/97
to

> > I just had a look at m"man crontab" and it appears to be user specific

> > eg the crontab is attached to a user and presumably that user needs to
> > be logged in for it to run.
>
> Most crontabs are attached to a user, but the user does not need to
> be logged in for it to run. Vixie cron also allows for a "system"
> crontab in /etc/crontab. This is specific to Vixie cron though,
> Dillon cron uses root's crontab for this.
>
> The "author" section of the cron man page will tell you which you
> have.


Like one post in this thread says, this is a subject a little too involved
for a USENET post... I would recommend the book "Essential System
Management" published by O'Reilly and Associates. It's worth it's weight
in bomb-grade plutomium, IMHO.

-Matt

Bob Hauck

unread,
Feb 11, 1997, 3:00:00 AM2/11/97
to

In article <32fb5...@news.ace.net.au>,
p...@ace.net.au writes:

> I just had a look at m"man crontab" and it appears to be user specific
> eg the crontab is attached to a user and presumably that user needs to
> be logged in for it to run.

Most crontabs are attached to a user, but the user does not need to
be logged in for it to run. Vixie cron also allows for a "system"
crontab in /etc/crontab. This is specific to Vixie cron though,
Dillon cron uses root's crontab for this.

The "author" section of the cron man page will tell you which you
have.

---
Bob Hauck bo...@wasatch.com
Wasatch Communications Group http://www.wasatch.com

Scott Ellsworth

unread,
Feb 11, 1997, 3:00:00 AM2/11/97
to

In article <slrn5fqgag....@ultra7.unl.edu.ar>, ral...@ultra7.unl.edu.ar (Roberto Alsina) wrote:
>In article <32FD20...@metronet.com>, Michael Walters wrote:
>>B.A.Mc...@bham.ac.uk wrote:
>>> In article <5d02n1$n...@gap.cco.caltech.edu> lbl...@alumnae.caltech.edu
> (lbliao) writes:
>>> >Subject: Re: How to use cron and other scheduling utilities on
>>> >linux/unix?
>>> RTFM.
>>Wow, there's a helpful and constructive response.
>
>Well, it's quite helpful, and constructive.
>Here it is in a more lengthy manner:

While I agree to a point, I would mention that you negelected to provide the
useful information of which FM to read. There are a lot of them, and a new
user may well not be terribly familiar with the extensive information
resources out there. Two lines is likely enough.

Having figured out cron and the use of a crontab only six months ago, it is
something I remember being loath to experiment with. Various rather useful
things get done by this daemon, and I did not want them all to fail. (A bad
command in a crontab will not bring the whole thing down, but I was too used
to other Unix utils, where a screwed up config file can kill the enitre
program run. A new user might well not know that cron is more robust than
that.)

>Try reading the cron man page: (type "man cron")

Yep. Here is where I would have stopped, as after that, they may have
specific questions appropriate to the news format.

I might also add "man crontab", as man cron on my system gave information that
was not terribly clear to me when I first tried to figure it out. The second
try worked pretty well, as I started with man crontab. This made
/etc/crontab's format far clearer. :) (I had not made the logical jump that
man sometimes documents the configuration files, as well as the programs in
question. Simple idea, but annoying if you have not realized it yet.)

>If that doesn't make sense, read a book about UNIX systems.

Got a favorite one? I read through the ORielly "Linux Network Administration"
book and the Que "Setting up a perfect internet site with Linux" and did not
find any useful cron information. Fair, as cron is really a general admin
tool, and I have not yet found a good book on general Linux system
administration that I like. YMMV.

>The use of cron and other scheduling utilities is much too complex and long
>to be explained in a USENET post.

Fully agreed. It is also fairly well documented in vixie cron.

>If the original poster doesn't understand the manuals, he can feel free
>to ask me over email.

>
>Is that a polite enough answer?
>
>Gee... now we need to have politically correct people helping others fix
>their problems for free, and not even ask that the other person bother
>reading the manuals?

Your responses are, of course, your business, but I find it helpful to put
which FM has the information if the program in question does not have just
one. This makes the person more likely to both solve the present problem, and
perhaps go away with a better idea of how to use the information already
availible. This leads to fewer newbie questions in the future. The RTFM
answer per se is perfectly reasonable, IMHO, if the user can reasonably be
expected to know where to find the information. For example, answering C++
questions with references to Marshall Cline's C++ FAQ web site has served me
very well, as the people often read a few other entries.

Scott

Scott Ellsworth sc...@eviews.com
"When a great many people are unable to find work, unemployment
results" - Calvin Coolidge, (Stanley Walker, City Editor, p. 131 (1934))
"The barbarian is thwarted at the moat." - Scott Adams

Paul Russell

unread,
Feb 12, 1997, 3:00:00 AM2/12/97
to

p...@ace.net.au writes:
>
> I just had a look at m"man crontab" and it appears to be user specific
> eg the crontab is attached to a user and presumably that user needs to
> be logged in for it to run. Or are contabs just system events
> created by specific users that will run anyway?

Why would the user need to be logged in for them to run? Wouldn't
that be *completely* pointless?

Allow me to illustrate how this works.

There is a powerful daemon, occupying the nether realm, called "cron".
We know cron exists, because cron has a man page (holy text which can
only be read by the inner circle) and because it shows up in "ps
auxwww | grep cron".

This powerful daemon accepts offerings from mortals, which are placed
upon the most holy alter of "/var/spool/cron/crontabs". Should you be
privileged enough, you may read these crontabs; each one named after
the mortals who placed them there. These incantations are read by
cron, which (at the designated hour) splits itself into two parts, and
transforms one of itselves into an exact likeness of the mortal in
question, which goes about the task specified.

If the task should produce output, these are not desired by the mighty
cron, and are returned to the offering mortal by way of "mail"; the
messenger of the gods. This is the other method by which we can know
that cron exists, and indeed, sometimes it will tell us that he is
angry - often by filling our mailbox.

So how do we make offerings? Firstly we read the lesser scriptures,
in "man crontab", and learn of the high priest, "crontab" who is both
a program and a file format, an ancient duality described fluently by
"man". The high priest allows mortals to submit humble and
well-formed offerings, to be placed upon the alter for cron's digest.

> I am wanting to rotate some logs once a day to stop them getting too
> big.

Ah! Then you would figure out a single line which did what you desire,
such as "mv /var/adm/messages /var/adm/messages.`date +%a%b%Y`; killall -HUP syslogd".

If your brain cannot concoct a single line incantation (which will be
read to the great "cron" by his sizable footslave "bash") then create
a shell script, or indeed a program, to do that which you most desire.
Create a single line incantation to run the script.

This task, most likely, would have to be run by "root", a demigod
herself, who nonetheless requires the omnipresent "cron" for its
tasks.

0 new messages