16.12.2012 Views

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

z/OS V1R9.0 UNIX System Services Command ... - Christian Grothoff

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

crontab<br />

Options<br />

0 0 * * * -- Midnight every day<br />

0 0 * * 1-5 -- Midnight every weekday<br />

0 0 1,15 * * -- Midnight on 1st and 15th of month<br />

0 0 1 * 5 -- Midnight on 1st of month and every Friday<br />

The sixth field of a crontab entry is a string that your shell executes at the specified<br />

time. When the shell executes this string, it sets the HOME, LOGNAME, PATH, and<br />

SHELL environment variables to default values for you.<br />

If the string in your crontab entry contains percent characters %, the shell interprets<br />

them as newline characters, splitting your string in several logical lines. The first<br />

logical line (up to the first %) is interpreted as the command you want to execute;<br />

subsequent logical lines are used as standard input to the command. If any real<br />

(not logical) line in the file is blank or begins with #, the shell ignores the line (treats<br />

it as a comment).<br />

To obtain the output of the command in your crontab entry, redirect the standard<br />

output (stdout) and the standard error (stderr) into a file. If you do not do this, the<br />

system mails you the output from the command.<br />

at, batch, and crontab submit jobs to cron; the data for those jobs may contain<br />

doublebyte characters. When the jobs are run, the data in the jobs are interpreted<br />

in the locale that cron is using. Because it is strongly recommended that cron be<br />

started in the P<strong>OS</strong>IX locale, doublebyte characters in the jobs may not be<br />

interpreted correctly. You can get around this by calling setlocale() in the job itself.<br />

–e Lets you edit your crontab entry. crontab invokes an editor to edit the entry.<br />

If you have an EDITOR environment variable defined, crontab assumes<br />

that the variable’s value is the name of the editor you want to use. If you do<br />

not have EDITOR defined, crontab uses vi.<br />

If you do not have a crontab entry, crontab sets up a blank entry for you.<br />

When you exit from the editor, crontab uses the edited entry as your new<br />

entry.<br />

–l Displays your current crontab entry on stdout.<br />

–r Removes (deletes) your current crontab entry.<br />

–u user<br />

Uses the crontab entry of user. The user specified has to be the same<br />

username that the crontab entry was created under in /usr/spool/cron/<br />

crontabs. This requires the appropriate privileges.<br />

You can specify only one of the –e, –l, or –r options.<br />

Environment Variables<br />

cron uses the following environment variables:<br />

EDITOR<br />

Specifies the editor that the –e option invokes. The default editor is vi.<br />

HOME Is set to your user ID’s home directory (not necessarily the current value of<br />

HOME) when the commands in your crontab entry are run.<br />

LOGNAME<br />

Is set to your user ID when the commands in your crontab entry are run.<br />

172 z/<strong>OS</strong> <strong>V1R9.0</strong> <strong>UNIX</strong> <strong>System</strong> <strong>Services</strong> <strong>Command</strong> Reference

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!