chpst(8)

πŸ“¦
version 2.3.1 Β· 3 versions
, in alpine 3.24, nixpkgs unstable, ubuntu resolute, ubuntu stonking

🌸 chpst(8) β€” System Manager's Manual 🌸

okay bestie, sit DOWN because this one is a whole vibe. chpst is from the runit family (manual section 8, system manager territory, we're in the big leagues now πŸ’…) and it's literally the "glow-up your process before you launch it" tool. Let's get into it ✨


✨ NAME ✨

chpst β€” runs a program with a changed process state πŸ¦‹


πŸŽ€ SYNOPSIS πŸŽ€

chpst [-vVP012] [-u user] [-U user] [-b argv0] [-e dir] [-/ root] [-C
pwd] [-n inc] [-l|-L lock] [-m bytes] [-d bytes] [-o n] [-p n] [-f
bytes] [-c bytes] [-t seconds] prog

πŸ’– DESCRIPTION πŸ’–

prog consists of one or more arguments. yes, plural, it can be a whole lil squad of args, not just one lonely word 🫢

chpst changes the process state according to the given options, and runs prog. that's the whole plot. you pick your transformations, and then your program gets launched into its new life. main character energy, but make it a fork exec. ✨


πŸ‘‘ OPTIONS πŸ‘‘

  • -u [:]user[:group] β€” setuidgid. sets uid and gid to the user's uid and gid, as found in /etc/passwd. if user is followed by a colon and a group, set the gid to group's gid, as found in /etc/group, instead of user's gid. if group consists of a colon-separated list of group names, chpst sets the group ids of all listed groups. if user is prefixed with a colon, the user and all group arguments are interpreted as uid and gids respectively, and not looked up in the password or group file. and heads up: all initial supplementary groups are removed. bye besties πŸ‘‹
  • -U [:]user[:group] β€” envuidgid. sets the environment variables $UID and $GID to the user's uid and gid, as found in /etc/passwd. if user is followed by a colon and a group, set $GID to the group's gid, as found in /etc/group, instead of user's gid. if user is prefixed with a colon, the user and group arguments are interpreted as uid and gid respectively, and not looked up in the password or group file. so it's vibes-only, no file lookups πŸ’œ
  • -b argv0 β€” argv0. run prog with argv0 as the 0th argument. yes queen, you get to pick your own name πŸŽ€
  • -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. so an empty file is a delete, not a blank set. noted 🫑
  • -/ root β€” chroot. change the root directory to root before starting prog.
  • -C pwd β€” chdir. change the working directory to pwd before starting prog. when combined with -/, the working directory is changed after the chroot. order matters, bestie, don't get it twisted ✨
  • -n inc β€” nice. add inc to the nice(2) value before starting prog. inc must be an integer, and may start with a minus or plus.
  • -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. patient queen behavior πŸ’…
  • -L lock β€” the same as -l, but fail immediately if lock is locked by another process. no waiting, we're busy, we're booked, we're not standing in line 😀
  • -m bytes β€” limit memory. limit the data segment, stack segment, locked physical pages, and total of all segment per process to bytes bytes each.
  • -d bytes β€” limit data segment. limit the data segment per process to bytes bytes.
  • -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 bytes.
  • -c bytes β€” limit core size. limit the core file size to bytes bytes.
  • -t seconds β€” limit CPU time. limit CPU time to seconds seconds, delivering a SIGXCPU thereafter. clock's ticking, bestie ⏰
  • -v β€” verbose. print verbose messages to standard error. this includes warnings about limits unsupported by the system. lowkey the most useful flag when something's not working, ngl πŸ”
  • -V β€” version string. print a version string to standard error.
  • -P β€” pgrphack. run prog in a new process group.
  • -0 β€” close standard input before starting prog. 🚫
  • -1 β€” close standard output before starting prog. 🚫
  • -2 β€” close standard error before starting prog. 🚫

πŸ”₯ EXIT CODES πŸ”₯

chpst 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. so like, if your program ate, chpst ate too. if it flopped, that's on the program 😭


🌈 EMULATION 🌈

if chpst is called as envdir, envuidgid, pgrphack, setlock, setuidgid, or softlimit, it emulates the functionality of these programs from the daemontools package respectively. one binary, six alter egos, it's giving shapeshifter πŸ¦‹βœ¨


πŸ’œ SEE ALSO πŸ’œ

sv(8), runsv(8), setsid(2), runit(8), runit-init(8), runsvdir(8), runsvchdir(8)


🫢 AUTHOR 🫢

Gerrit Pape <pape@smarden.org>


and that's the tea, bestie πŸ“ this whole page came to you straight from the System Manager's Manual β€” the chpst(8) page itself, no cap. go forth and change some process state, you absolute icon πŸ’…πŸ‘‘βœ¨

πŸ“¦ where this page comes from