View previous topic :: View next topic |
Author |
Message |
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Fri Jan 17, 2003 11:55 am Post subject: vcron |
|
|
Soo.... Can anybody give me a good discription of how to use cron?
The man page for vcron is.... lacking, to say the least.
I swear there used to be a doc on using cron in gentoo... But I can't find it. |
|
Back to top |
|
|
tukem Tux's lil' helper
Joined: 25 Jun 2002 Posts: 114 Location: Tampere, Finland
|
Posted: Fri Jan 17, 2003 7:45 pm Post subject: |
|
|
I don't what kind of information you were looking for but I think "man 5 crontab" gives fairly decent information on the usage. |
|
Back to top |
|
|
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Fri Jan 17, 2003 11:58 pm Post subject: |
|
|
Ok... that helps a little... Most of that stuff I had found out though.
And for as long as I've used linux it's surprising that I've never figured out putting the number in the man statement to get the different man page if there is more than one until now
Okay, what I can't seem to figure out is... What is the whole cron.daily cron.hourly stuff? |
|
Back to top |
|
|
tukem Tux's lil' helper
Joined: 25 Jun 2002 Posts: 114 Location: Tampere, Finland
|
Posted: Sun Jan 19, 2003 3:14 pm Post subject: |
|
|
I guess you have already figured out what those cron.daily, cron.weekly, ... are but everybody else might not know.
File /etc/crontab is the system level crontab file. Generally system level scripts are run from here but Gentoo has a bit different appoach. The crontab file appears to contain a line that runs a script /etc/sbin/run-crons every fifteen minutes. This script then checks the directories cron.hourly, cron.daily, cron.weekly and cron.monthly for scripts to be executed
With this system it's not necessary to learn how the actual cron program works. Adding a file containing desired script into correct directory is all that is needed. |
|
Back to top |
|
|
Seth Apprentice
Joined: 25 May 2002 Posts: 156 Location: U.S.
|
Posted: Sun Jan 19, 2003 4:08 pm Post subject: |
|
|
tukem wrote: |
File /etc/crontab is the system level crontab file. Generally system level scripts are run from here but Gentoo has a bit different appoach. The crontab file appears to contain a line that runs a script /etc/sbin/run-crons every fifteen minutes. This script then checks the directories cron.hourly, cron.daily, cron.weekly and cron.monthly for scripts to be executed
|
I've been wondering how that works. Thanks for explaining.
But what if you want to run a cron job at 3:00 am on the first day of the month? Is the cron.daily|weekly|monthly setup flexible enough to do that?
Thanks,
Seth |
|
Back to top |
|
|
tukem Tux's lil' helper
Joined: 25 Jun 2002 Posts: 114 Location: Tampere, Finland
|
Posted: Sun Jan 19, 2003 4:26 pm Post subject: |
|
|
Well for that kind of use cron.daily, weekly, monthly is too unflexible. But in workstation use where the computer isn't necessarily on at 3:00 am on the first day of the month this system works. The script is simply run when the computer is turned on again. |
|
Back to top |
|
|
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Sun Jan 19, 2003 11:55 pm Post subject: |
|
|
tukem wrote: | I guess you have already figured out what those cron.daily, cron.weekly, ... are but everybody else might not know.
File /etc/crontab is the system level crontab file. Generally system level scripts are run from here but Gentoo has a bit different appoach. The crontab file appears to contain a line that runs a script /etc/sbin/run-crons every fifteen minutes. This script then checks the directories cron.hourly, cron.daily, cron.weekly and cron.monthly for scripts to be executed
With this system it's not necessary to learn how the actual cron program works. Adding a file containing desired script into correct directory is all that is needed. |
Actually I hadn't figured this out yet... Well, that part about it running scripts yet... But I can't seem to get it to work. I figured, hey, maybe it means the crontab files are scripts... didn't work. So then I thought maybe it meant bash scipts... Didn't work...
What EXACTLY are you supposed to put in that directory? |
|
Back to top |
|
|
ronmon Veteran
Joined: 15 Apr 2002 Posts: 1043 Location: Key West, FL
|
Posted: Mon Jan 20, 2003 12:50 am Post subject: |
|
|
Both /bin/sh and /bin/bash scripts will work. Did you remember to set it executable?
Code: |
chmod 755 /etc/cron.daily/myscript.cron
|
They can be really simple, like my updatedb.cron...
Code: |
#! /bin/bash
/usr/bin/updatedb
|
...or as complex as you like. |
|
Back to top |
|
|
gzaector Tux's lil' helper
Joined: 24 Nov 2002 Posts: 132 Location: 304
|
Posted: Mon Jan 20, 2003 1:46 am Post subject: |
|
|
if someone didnt want to use the whole hour/day/week/month system, couldnt they just take the enteries out of /etc/crontab, then add whatever they wanted into /etc/crontab? |
|
Back to top |
|
|
ronmon Veteran
Joined: 15 Apr 2002 Posts: 1043 Location: Key West, FL
|
Posted: Mon Jan 20, 2003 1:57 am Post subject: |
|
|
You can just add them to crontab without removing the others. Like this one for gentoo-stats:
Code: |
0 0 * * 0,4 /usr/sbin/gentoo-stats --update >/dev/null
|
|
|
Back to top |
|
|
drakonite l33t
Joined: 02 Nov 2002 Posts: 768 Location: Lincoln, NE
|
Posted: Mon Jan 20, 2003 3:38 am Post subject: |
|
|
ronmon wrote: | Both /bin/sh and /bin/bash scripts will work. Did you remember to set it executable?
|
How do you do the *smack myself in the head for missing the obvious* emoticon?
Thanks... I'll have to wait for a little while to see if it works or not but I'm guessing it probably will. |
|
Back to top |
|
|
|