Contents | < Browse | Browse >
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Using Crons and Crontabs by David Tiberio %%
%% dtiberio@libserv1.ic.sunysb.edu %%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Using Crons and Crontabs - by David Tiberio
There may be a large number of you out there who, like me,
either leave your computer on all the time or use it at a
regular time on a daily basis. When this is the case, it is
nice to have a crontab to perform tasks throughout any given
day.
For example, I have a terrible time getting ready for school.
My clocks all tell different times, and sometimes when trying to
turn them off in the morning I accidentally set the time a few
minutes ahead. And I have 4 alarms! One is about 10 minutes
ahead, my watch is 10 minutes ahead, another clock is 30 minutes
ahead, and another is 40 minutes ahead. Although after this
morning I think there may be a new record...
Another problem I have is that on Monday, Wednesday, and
Friday, I have to go to class at 8:20am, which on Tuesday and
Thursday, I go to class at 8:30am. As luck would have it, I
arrive early twice a week and barely make it three times a week.
Now here is where my crontab comes in. My computer is on all
night. Overnight, it performs operations that I feel are needed.
For example, when I ran a BBS it used to backup my files, or
download UUCP news from another BBS. But now it wakes me up in
the morning. Every ten minutes it announces the time using the
narrator.device. But on Monday, Wednesday, and Friday, I set it
to announce the time ten minutes early, so at 8:00am it will
announce that it is 8:10am, time to be at class. :)
Another use is for it to remind me which books to take to
class, or on weekends, to remind me that there are no classes.
Same when classes are canceled. Since my loft is above my
computer, I don't even have to get out of bed.
At 2pm it reminds me that the bank closes in one hour. At
4pm it reminds me that the post office closes soon. Although
I do not go to each every day, I do go at least once a week,
which makes it very useful.
On Thursday nights at 7:55pm, time to put the TV on channel 5.
Then at 8:55pm, time for channel 4. Once 11pm comes around, I
am reminded to finish my homework. And at midnight, it reminds me
to go to sleep. Also for the sake of security, I get reminded a
few more times after that just so the point gets across.
But there are other uses. Every morning at 6:01am, my
PhonePak Lineman is executed. This program must be running at all
times in case someone calls, making it capable of answering the
phone or accepting a FAX. If Lineman is not running (I may
accidentally close the window, which I do often), it will be
executed. If it is already running, it will not execute another
copy.
Here is a sample s:crontab file. Comments are followed by
a # symbol.
#<min> <hour> <day> <month> <week_day> [<command>]
00 6 * * 2,4 say six ay em. time to wake up.
01 6 * * * run sys:wbstartup/lineman
02 6 * * 1,2,3,4,5 execute s:wakeup-sequence
45 6 * * 0,6 c:hear -b 15000 xdh1:iff.8svx/goodvibrations.8svx
At 00 minutes 6 hours, every day, every month, on the second
and fourth days of the week, the system announces the current time.
One minute later, my PhonePak is put online in the event that it
was closed the day before. At 6:02am, a wakeup-sequence script is
executed which ensures that I will wake up. And later at 6:45am,
on weekends, it plays a few minutes of an audio sample off of my
hard drive (nice song to wake to).
The format for the crontab is simple:
minutes hours date months weekdays commands
MINUTES ranges from 00 to 59
HOURS ranges from 0 to 23, 24 hour time
DATE ranges from 1 to 31 (day of the month)
MONTHS ranges from 1 to 12 (January to December)
WEEKDAYS ranges from 0 to 6 (Sunday to Saturday)
COMMANDS includes any standard CLI/Shell command and arguments
Here are some more samples:
* * * * * #every second
00 * * * * #beginning of every hour
00 0,12 * * * #beginning of hour at midnight and noon
00 1 3 7 * #July 4th at 1:00am
Good luck in using crontabs. In order to use them with your
Amiga, you will need a cron reader, such as CyberCron, DCron, or
TPTCron. Of the ones I have tested, I found Cybercron to be the
most stable under Workbench 2.04.
Check Fred Fish disks or look for these two files on Aminet.
CyberCron15.lha os20/cli 78K+Schedule jobs at specific times.
TPTCron.lha util/cli 32K*Executes jobs repeatedly at given
times
David Tiberio
dtiberio@libserv1.ic.sunysb.edu