-
Notifications
You must be signed in to change notification settings - Fork 1
Job Overview
job - Linux jobs overview
A job is a group of related processes all descended from a point of
entry process and identified by a unique job identifier (jid). A job
can contain multiple process groups or sessions, and all processes in
one of these subgroups can only be contained within a single job.
Not every process on the system is part of a job. That is, only processes which are started by a login initiator like login, rlogin, rsh and so on, get assigned a job ID. In the Linux environment, jobs are created via a PAM module.
In addition, it is possible for batch schedulers or similar programs to place certain processes in job containers for tracking or signaling purposes.
Jobs are managed by a userspace daemon process and have the following characteristics:
-
A job is an inescapable container. A process cannot leave the job nor can a new process be created outside the job without explicit action, that is, a system call with root privilege.
-
Each new process inherits the
jidfrom its parent process. -
All point of entry processes (job initiators) create a new job as configured.
-
Job initiation on Linux is performed via a PAM session module.
-
The job initiator performs authentication and security checks.
-
Not all processes on a system need be members of a job.
-
The process control initialization process ([init]) and startup scripts called by init are not part of a job.
Job initiators can be categorized as either interactive or batch processes.
Note: The existing command [jobs][] applies to shell "jobs" and it is not related to the feature described above. The [at][], [atd][], [atq][], [batch][], [atrun][], [atrm][]) man pages refer to shell scripts as a job. a shell script.
jwait - await completion of a job
jwait jid
jwait waits for the job whose job ID is jid and reports its termination status. The termination status is determined based upon the last process to exit the job.
The root user can wait on any process on the system. All other users can only wait on jobs that they own.
jid
The identifier for the job that jwait should await until completion.
jstat - displays job status information
jstat [-a | -j jid]-l -p
The jstat command displays information for active jobs.
The jstat command accepts the following options:
-a
Displays information about all jobs.
-j job_id
Displays information only for the specified job ID (jid).
-l
This option is not yet implemented.
-p
Print process information about the job or jobs including JID, Owner, PID, PPID, and command.
If neither the -a or -j option are specified it is assumed that the
job in question is for the current process.
If no options are specified, the jstat command will return the current
jid, user name of the job owner, and primary (oldest) command for that
job. The job ID is printed out in hexadecimal.
% jstat
JID OWNER COMMAND
0x17 dan -ksh
If the -j option with a jid argument is specified, the jstat
command will return summary information for the entered job: jid, owner,
and command. The jid argument is expected in hexadecimal. The "0x"
prefix is optional.
% jstat -j 0xab001f00000000ba14
JID OWNER COMMAND
0xab001f000000ba14 janet -csh
If the -p option is specified, the jstat command will print out
information for each process that belongs to that job. Process
information includes the job JIDs, PIDs, PPIDs, and COMMAND information
for the job. Summary information is always printed.
% jstat -p
JID PID PPID COMMAND
0xab001f000000ba14 2225 2308 -csh
0xab001f000000ba14 2350 2225 jstat -p
If the -a option is specified, the jstat command prints out
information for all jobs on the system.
% jstat -a
JID OWNER COMMAND
0xab001f0000000e9a root -ksh
0xab001f000000ba14 janet -csh
0xab001f000000ba18 dan -ksh
jxcsa - start or stop CSA daemon
jxcsa {start|stop}
jxcsa starts or stops the CSA daemon (Comprehensive System Accounting), which runs as a thread in the job daemon (jobd) process.
This command should only be run from the /etc/init.d/csa script; see
the csa man page for more information.
jkill - send signal to a job
jkill [ -signal ] jid ...
jkill -l
jkill sends the specified signal to the processes contained in the job(s) identified by the jid(s). If no signal is specified, the TERM signal is sent. The TERM signal will kill processes which do not catch this signal. For other processes, if may be necessary to use the KILL (9) signal, since this signal cannot be caught.
jid ...
Specify the list of jobs that kill should signal.
-signal
Specify the signal to send. The signal may be given as a signal name or number.
-l
Print a list of signal names. These are found in /usr/include/linux/signal.h
jattach - Attach a processes to a job
jdetach pidjid
jattach allows a process which currently is not attached to any job to be attached to the specified job. This command is useful with the jdetach command for those occasions where you want to move processes from one job to another job.
To successfully attach a process to a job, the user must be root or have the CAP_SYS_RESOURCE capability.
pid
The identifier for the attaching process.
jid
The identifier for the job to be attached.
jsethid - enable unique job ID (jid) values
jsethid hex-value
jsethid is used by startup scripts to enable generation of unique job ID (jid) values on systems within a cluster.
hex-value
The value used by the current host for generation of unique (jid) values. Normally, the host ID value is used for this purpose.
jdetach - Detach a group of processes from a job
jdetach -p pid | -j jid
jdetach allows a process, or all processes attached to a job, to be detached from a job. The processes are allowed to continue running after they are detached. This command is useful for those occasions where you accidently start a daemon process within a job and need to move that daemon process out of the job.
To successfully detach a process from a job, the user must be root or have the CAP_SYS_RESOURCE capability.
The jdetach command accepts that following options:
-p pid
Detach the process identified by the specified pid (process ID).
-j jid
Detach all processes attached to the job specified by jid (job ID).
Linux CSA is the outcome of a joint effort between Los Alamos National Laboratory (LANL) and SGI to port the IRIX CSA tool to the Linux Operating System. This project is a community driven fork of that code base and is not supported by either organization at this time.