z/OS UNIX System Services Planning
Previous topic | Next topic | Contents | Contact z/OS | Library | PDF


Scheduling at and cron jobs

z/OS UNIX System Services Planning
GA32-0884-00

Schedule cron jobs by using at or crontab.

Examples:
  1. To run bigcopy.sh script at 11:00 p.m., issue:
    at -f bigcopy.sh 23:00
    To list the at jobs, issue at -l.
  2. To schedule regular jobs, issue:
    crontab myjobs
    myjobs contains the following entries:
    0  0 * * *   /u/admin/daily_bup   >>/etc/bup_log 2>>&1  #midnight daily 
    30 1 * * 6   /u/admin/weekly_bup  >>/etc/bup_log 2>>&1  #1:30 every Saturday
    Input consists of six fields, separated by blanks. All blank lines and any input that contain a # as the first non-blank character is ignored. The first five fields give a date and time in the following form:
    • A minute, expressed as a number from 0 through 59.
    • An hour, expressed as a number from 0 through 23.
    • A day of the month, expressed as a number from 1 through 31.
    • A month of the year, expressed as a number from 1 through 12.
    • A day of the week, expressed as a number from 0 through 6 (with 0 standing for Sunday).

    Any of these fields can contain an asterisk (*) standing for all possible values. For example, if you have an * as the day of the month, the job runs every day of the month.

    The sixth field of a crontab entry is a string that the shell executes at the specified time.

To list the crontab jobs, issue crontab -l.

Note:
  1. crontab jobs do not run with the shell variable definitions that exist when crontab was invoked. Also, login profiles are not run. The only environment variables that are set are HOME, LOGNAME, PATH, SHELL, and TZ.

    However, at jobs inherit the current environment variables.

  2. To ensure that user IDs that share a UNIX UID have the correct settings, the user's HOME and LOGNAME environment variables are set according to the MVS™ identity of the user.
  3. PATH is set to the system default. If you want to invoke commands or scripts in other directories, you need to specify the full path name or set the PATH variable in your crontab job.
  4. The shell variable is set to /bin/sh.

Rule: Do not change or put other files in these spool directories:

Go to the previous page Go to the next page




Copyright IBM Corporation 1990, 2014