Previous topic |
Next topic |
Contents |
Contact z/OS |
Library |
PDF
Using & at the end of a command z/OS UNIX System Services Planning GA32-0884-00 |
|
Using an & at the end of a command starts the command in the background. The shell forks a child process, executes the command program, and then does not wait for the command to complete. Some daemons must be started this way in order to allow the invoking shell script (such as /etc/rc) to continue. cron does not need to be started with an & because it forks itself to create the child process, which continues running while the cron parent process returns to the invoker such as /etc/rc. If the script does /usr/sbin/cron, the shell will spawn the cron program to create a child process, and then the cron program will fork a child process to run the daemon independently. The cron command returns to the shell, and the script continues. However, system programmers might want the cron daemon
process to have a job name. To do this from a shell script, you can
use the _BPX_JOBNAME environment variable. (This can be done on the
command line, or in a prior export command.) The _BPX_JOBNAME variable
assigns the job name to executed programs, running in forked processes,
but not to locally spawned processes. As a result, the shell command
cannot assign the job name
to the cron daemon. (It depends if the spawn
is done within the same address space.) But, the shell command
will assign the job name to the cron daemon,
because it is run with a fork/exec. |
Copyright IBM Corporation 1990, 2014
|