ARCHIVED: Cron: Schedule jobs on the IU WWW servers
On this page:
Overview
- It is possible to schedule the execution of UNIX shell scripts (written in the syntax of the csh, ksh, or sh shells), Perl scripts, C scripts, etc. from your central WWW server account.
- You do not need to request cron, as all accounts on Webserve are automatically enabled for its use.
Create the cron files
- The files you create will be placed in the
bin
subdirectory in your login directory. (If you prefer, you may place them in another directory, but not inside either thewww
orwwws
directory.)To create the
bin
subdirectory, log into your account and typemkdir bin
. It's no problem if you receive a message that the directory already exists. - To move to that directory, type
cd bin
.The first file is a shell/Perl/C script that contains the commands you wish to have executed on a schedule by the cron system.
The second file contains the directives to the cron job scheduling system that will cause your script to run at the desired time on the desired days. A shorthand name for this file is the crontab (for "cron table") file for your account.
The file should have a name which is the name of your account followed by
.crontab
. If my account name isaccount
, then the filename would beaccount.crontab
. You should also adjust the output of your cron application to a file or /dev/null; for example, suppose your crontab had the following entry at the end of the line:0 * * * * /ip/account/bin/my_cron_app.pl
You can have the output piped to a file by adding:
0 * * * * /ip/account/bin/my_cron_app.pl >> /ip/account/bin/my_cron_app_output.log 2>&1
Above, the
>>
appends to the log file; a single>
will cause the file to be overwritten. If you never want to see the output, pipe to /dev/null:0 * * * * /ip/account/bin/my_cron_app.pl > /dev/null 2>&1
- To submit your crontab file,
account.crontab
, to the cron system, entercrontab account.crontab
. After you make changes to your crontab file, you have to re-submit it.
Identify existing cron jobs
If you are an account owner who has lost track of your existing crontab file, to examine any cron entries for an account, log into your account on Webserve via SSH and enter:
crontab -l
To pipe this to a new crontab file, use:
crontab -l > crontab.file (a file name of your choice)
If you receive the message below, you do not have cron jobs set up for that account:
You (account) are not allowed to use this program (crontab)
See crontab(1) for more information
To see additional information, while logged into your account, enter:
man crontab
This is document bfsk in the Knowledge Base.
Last modified on 2021-09-08 10:22:10.