[plug] Cron Jobs
Jason Nicholls
jason at mindsocket.com.au
Thu Jul 11 00:40:40 WST 2002
G'day,
On Wed, Jul 10, 2002 at 12:22:42PM -0400, Steege, Phil E wrote:
> It is pretty easy using the crontab command.
> 'crontab -l' will show the contents of your crontab file listing the
> scheduled jobs.
> 'crontab -e' will allow you to edit it.
> 'man crontab' should be all you need.
I'm a little uncertain whether he was after help with setting cron jobs or
writing scripts for cron to execute.
> > From: Joel Fraser [mailto:joel231 at yahoo.com]
> > I was wondering if anyone has a site that could help me with writing
> > cron jobs, as i havent done this before and need a little help with it.
What exactly are you trying to achieve, or just messing about?
Here is simple example.
First a script, lets say it's in a file called "~/bin/simple.sh":
--------------------------------------------
#!/bin/bash
echo "the time is" `date` >> ~/simple.output
--------------------------------------------
Next up, a crontab entry (crontab -e):
--------------------------------------------
# run at 30mins past the hour, every hour, every day, every month
30 * * * * ~/bin/simple.sh
--------------------------------------------
What we've done here is write a shell script to create output like:
the time is Thu Jul 11 00:37:15 WST 2002
And have cron run this every hour. After a while the file would look like:
the time is Thu Jul 11 00:30:00 WST 2002
the time is Thu Jul 11 01:30:00 WST 2002
the time is Thu Jul 11 02:30:00 WST 2002
the time is Thu Jul 11 03:30:00 WST 2002
the time is Thu Jul 11 04:30:00 WST 2002
the time is Thu Jul 11 05:30:00 WST 2002
"man 5 crontab" for info on setting crontab entries.
Regards,
Jason Nicholls
--------------------------------------------------------------------
Jason Nicholls icq: 11745841 email: <jason at mindsocket.com.au>
http://jason.mindsocket.com.au/ mobile: 0417 410 811
--------------------------------------------------------------------
pgp/gpg id: 0xC3844959
fingerprint: 7F7A 5846 4E94 459C 104D A979 7079 24CF C384 4959
More information about the plug
mailing list