View previous topic :: View next topic |
Author |
Message |
mgillespie Apprentice
Joined: 16 Dec 2003 Posts: 170
|
Posted: Thu Dec 16, 2004 7:31 pm Post subject: Cron job for certain times of day/week |
|
|
I have a script that emails summaries of my email waiting on my POP3 server to my work email address on a hourly basis. I have a small script in shell script /etc/cron.hourly that does it.
The problem is, that each morning I get loads of messages, and after a weekend, I get STACKS of messages!! I want the script to run hourly 09:00 to 17:00 M-F.
How can I do this? Examples welcome!! Cheers. |
|
Back to top |
|
|
hensan l33t
Joined: 26 Jun 2003 Posts: 868 Location: Sweden
|
Posted: Thu Dec 16, 2004 8:02 pm Post subject: |
|
|
Run the script directly from /etc/crontab. Add a line something like this:
Code: | 0 * * * 1-5 <user> <path to mailscript> |
This would execute the script once every hour monday through friday. Read man 5 crontab for more details on the syntax. The manpage doesn't mention the <user> field, but it appears in the gentoo default crontab, don't know if it's nescessary. |
|
Back to top |
|
|
tomk Bodhisattva
Joined: 23 Sep 2003 Posts: 7221 Location: Sat in front of my computer
|
Posted: Thu Dec 16, 2004 8:18 pm Post subject: |
|
|
You'll probably want something like this:
Code: | 0 9-17 * * 1-5 <command to execute> |
_________________ Search | Read | Answer | Report | Strip |
|
Back to top |
|
|
mgillespie Apprentice
Joined: 16 Dec 2003 Posts: 170
|
Posted: Thu Dec 16, 2004 8:58 pm Post subject: |
|
|
Thanks, that seems to work.... |
|
Back to top |
|
|
|