10. Chronological Jobs
(sh = Bourne shell, ksh = Korn shell, csh = C shell)
1. Modify the below in their respective shell to make something occur every time you
login:
2. Modify these to make something occur every time you logoff
3 utilities that will run jobs for you at another time are: cron, at, and batch, which are located in /etc/cron.d
Differences in chronological job types |
||
Cron | At | Batch |
Runs periodically | Runs once at a specific time | Runs once but not a specific time |
Repeatedly runs |
To run chronological jobs do the following:
cron Make a file called cron.allow or cron.deny (not both!)
Put user name in cron.allow for specific people allowed, cron.deny for certain people not allowed at & batch Make a file called at.allow or at.deny (not both!) Put user name in at.allow for specific people allowed or cron.deny for certain people not allowed (the at. applies to both at and batch files)
at command syntax - at [time to begin job] [ date] (i.e. at 10am august 23) after you type the at command you will get an at> prompt then you can type commands i.e.: at> audioplay /usr/demo/sound/sounds/bark.au (this is the syntax of commands with the at> prompt - [ command] [where file is located to play]
For batch files you will also get an at> prompt but you dont need to enter a time.
For cron jobs do the following (make sure have EDITOR=vi in your .profile file, another way is to setenv editvi for cshell or export editor, editor=vi for sh and Ksh)
The following is the syntax for setting up time: mmhhhhdd mm dd- this first m is for
minute (0-59 (so 10=10 min after hour), the hs are for hour (0-23), ds are for
day (of month 1-31) the second set of ms are for month (1-12), and the second set of
ds are for day of week (0=Sunday, 1=Monday, 2=Tuesday, etc., *=doesnt matter
which day)
*=Note: Doesnt matter for all fields, be careful when putting in minutes field,
because your cron job will run every minute
To edit go into crontab using vi editor and type syntax, example: 0 12 * * 1 echo Monday Meeting | mailx s dont forget all (the preceding would mail a message to all users at 12:00 on Monday) -or- 0 12 * * 1 mailx s dont forget all , /export/home/joe/reminder (this is the same as the above message)
Go to Chapter 9
Go to Index
Go to Chapter 11