Re: cron quarterly
- From: ibuprofin@xxxxxxxxxxxxxxxxxxxxxx (Moe Trin)
- Date: Sun, 25 May 2008 14:18:29 -0500
On Sun, 25 May 2008, in the Usenet newsgroup comp.unix.admin, in article
<2818f438-ec32-4d20-bda7-157b99742704@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
leehanken wrote:
NOTE: Posting from groups.google.com (or some web-forums) dramatically
reduces the chance of your post being seen. Find a real news server.
On 25 May, 14:20, leehanken <leehan...@xxxxxxxxx> wrote:
Hi, every three months I run a postgres report on our CentOS 4 server
to extract statistics from the database for the preceeding quarter,
which I then email to the managers.
OK - CentOS should be vixie-cron - so 'man 5 crontab'
I have written a script that can be run with a single command logged
in as root, to automatically work out the dates required, run the
query, then email the results. Is it possible to schedule my script
to run at the beginning of each financial quarter without my
intervention (using cron)?
So that would go in either "root's" crontab (as root, 'crontab -e') or
the system crontab (/etc/crontab). Be sure to test the script,
because the environment in cron is a heck of a lot more restrictive
than as root or a user. Use the 'set' command to see what your
environment looks like, and make a cron job to run that same command,
redirecting the results into a file.
[compton ~]$ wc *environment
20 19 236 cron.environment
41 50 585 nobody.environment
51 71 875 root.environment
39 46 1377 user.environment
151 186 3073 total
[compton ~]$
To answer my own question, it looks like I either put 4 separate
entries in the crontab,
man 5 crontab
0 1 1 1,4,7,10 * /path/to/executescript
would run the job a 01:00 on the first of {Jan|Apr|Jul|Oct}. If that
were the _system_ crontab rather than root's, you'd have to add the
'user to run as' between the star and the command. It's in the man
pages.
Old guy
.
- References:
- cron quarterly
- From: leehanken
- Re: cron quarterly
- From: leehanken
- cron quarterly
- Prev by Date: Re: cron quarterly
- Next by Date: ssh question
- Previous by thread: Re: cron quarterly
- Next by thread: ssh question
- Index(es):
Relevant Pages
|