chpst(8)
πΈ 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. ifuseris followed by a colon and a group, set the gid togroup's gid, as found in/etc/group, instead ofuser's gid. ifgroupconsists of a colon-separated list of group names,chpstsets the group ids of all listed groups. ifuseris 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$UIDand$GIDto the user's uid and gid, as found in/etc/passwd. ifuseris followed by a colon and a group, set$GIDto the group's gid, as found in/etc/group, instead ofuser's gid. ifuseris 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. runprogwithargv0as 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 directorydir: ifdircontains a file namedkwhose first line isv,chpstremoves the environment variablekif it exists, and then adds the environment variablekwith the valuev. the namekmust not contain=. spaces and tabs at the end ofvare removed, and nulls invare changed to newlines. if the filekis empty (0 bytes long),chpstremoves the environment variablekif 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 torootbefore startingprog.-C pwdβ chdir. change the working directory topwdbefore startingprog. when combined with-/, the working directory is changed after the chroot. order matters, bestie, don't get it twisted β¨-n incβ nice. addincto thenice(2)value before startingprog.incmust be an integer, and may start with a minus or plus.-l lockβ lock. open the filelockfor writing, and obtain an exclusive lock on it.lockwill be created if it does not exist. iflockis locked by another process, wait until a new lock can be obtained. patient queen behavior π-L lockβ the same as-l, but fail immediately iflockis 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 tobytesbytes each.-d bytesβ limit data segment. limit the data segment per process tobytesbytes.-o nβ limit open files. limit the number of open file descriptors per process ton.-p nβ limit processes. limit the number of processes per uid ton.-f bytesβ limit output size. limit the output file size tobytesbytes.-c bytesβ limit core size. limit the core file size tobytesbytes.-t secondsβ limit CPU time. limit CPU time tosecondsseconds, delivering aSIGXCPUthereafter. 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. runprogin a new process group.-0β close standard input before startingprog. π«-1β close standard output before startingprog. π«-2β close standard error before startingprog. π«
π₯ 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
- alpine 3.24: runit-doc 2.3.1-r0 Β· BSD
- nixpkgs unstable: runit 2.3.1
- ubuntu resolute: runit 2.3.0-1ubuntu1 Β· BSD-3-Clause
- ubuntu stonking: runit 2.3.1-5ubuntu1 Β· BSD-3-Clause
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms