chpst - runs a program with a changed process state
[-u user] [-U user] [-e dir] [-/ root] [-l|-L lock] [-m bytes] [-o n] [-p n] [-f bytes]
[-c bytes] prog
prog consists of one or more arguments.
changes the process state according to the given options, and runs prog.
exits 100 when called with wrong options. It prints an error message and
exits 111 if it has trouble changing the process state. Otherwise its exit
code is the same as that of prog.
If chpst is called as envdir(8),
envuidgid(8), pgrphack(8), setlock(8), setuidgid(8), or softlimit(8), it
emulates the functionality of these programs from the daemontools package
runsv(8), runsvctrl(8), runsvstat(8), runsvdir(8),
- -u user[:group]
- setuidgid. Set uid and gid to the user’s uid and gid.
If user is followed by a colon and a group, set the gid to group’s gid instead
of user’s gid. All supplementary groups are removed.
- -U user[:group]
Set the environment variables $UID and $GID to the user’s uid and gid. If
user is followed by a colon and a group, set $GID to the group’s gid instead
of user’s gid.
- -e dir
- envdir. Set various environment variables as specified
by files in the directory dir: If dir contains a file named k whose first
line is v, chpst removes the environment variable k if it exists, and then
adds the environment variable k with the value v. The name k must not contain
=. Spaces and tabs at the end of v are removed, and nulls in v are changed
to newlines. If the file k is empty (0 bytes long), chpst removes the environment
variable k if it exists, without adding a new variable.
- -/ root
- chroot. Change
the root directory to root before starting prog.
- -l lock
- lock. Open the file
lock for writing, and obtain an exclusive lock on it. lock will be created
if it does not exist. If lock is locked by another process, wait until a
new lock can be obtained.
- -L lock
- The same as -l, but fail immediately if
lock is locked by another process.
- -m bytes
- limit memory. Limit the data segment,
stack segment, locked physical pages, and total of all segment per process
to bytes bytes each.
- -o n
- limit open files. Limit the number of open file
descriptors per process to n.
- -p n
- limit processes. Limit the number of processes
per uid to n.
- -f bytes
- limit output size. Limit the output file size to bytes
- -c bytes
- limit core size. Limit the core file size to bytes bytes.
- verbose. Print verbose messages to standard error. This includes warnings
about limits unsupported by the system.
- pgrphack. Run prog in a new process
- Close standard input before starting prog.
- Close standard output
before starting prog.
- Close standard error before starting prog.
Gerrit Pape <email@example.com>
Table of Contents