Cron: Scheduling jobs on the IU WWW servers

On this page:


Introduction

  • 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.

Creating the cron files

  1. 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 the www or wwws directory.)

    To create the bin subdirectory, log into your account and type mkdir bin. It's no problem if you receive a message that the directory already exists.

  2. 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 is account, then the filename would be account.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.pl 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
  3. To submit your crontab file, account.crontab, to the cron system, enter crontab account.crontab. After you make changes to your crontab file, you have to re-submit it.

Identifying 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 2015-10-16 00:00:00.

  • Fill out this form to submit your issue to the UITS Support Center.
  • Please note that you must be affiliated with Indiana University to receive support.
  • All fields are required.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.

  • Fill out this form to submit your comment to the IU Knowledge Base.
  • If you are affiliated with Indiana University and need help with a computing problem, please use the I need help with a computing problem section above, or contact your campus Support Center.

Please provide your IU email address. If you currently have a problem receiving email at your IU account, enter an alternate email address.