cron quarterly - Unix
This is a discussion on cron quarterly - Unix ; 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. I have written a script that can be run ...
| | LinkBack | Tools |
|
#1
| |||
| |||
| to extract statistics from the database for the preceeding quarter, which I then email to the managers. 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)? |
|
#2
| |||
| |||
| On 25 May, 14:20, leehanken > 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. 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)? To answer my own question, it looks like I either put 4 separate entries in the crontab, or run the following on the first of each month: case `date +%m` in 01|04|07|10) executescript ;; esac |
|
#3
| |||
| |||
| On Sun, 25 May 2008, in the Usenet newsgroup comp.unix.admin, in article <2818f438-ec32-4d20-bda7-157b99742704@x41g2000hsb.googlegroups.com>, 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 >> 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 |
« Previous Thread
|
Next Thread »
| Tools | |
| |
| | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| "Cron <root@FooBar> test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily" | unix | Debian | 4 | 10-06-2007 01:10 PM |
| default permissions of cron.allow and cron.deny | unix | SUN | 3 | 10-06-2007 05:42 AM |
| Quarterly ASCII posting of SCO Programmer's FAQ | unix | SCO | 0 | 10-04-2007 05:53 AM |
| Third Issue of the Quarterly OS2eCS eZine is Available | unix | OS2 | 0 | 10-02-2007 01:47 AM |
| "Cron <root@FooBar> test -x /usr/sbin/anacron || run-parts --report /etc/cron.daily" | unix | Help | 4 | 09-30-2007 03:14 PM |
All times are GMT. The time now is 09:37 AM.
