{
    "mode": "man",
    "parameter": "chpst",
    "section": "8",
    "url": "https://www.chedong.com/phpMan.php/man/chpst/8/json",
    "generated": "2026-06-12T13:21:39Z",
    "synopsis": "chpst  [-vVP012]  [-u user] [-U user] [-b argv0] [-e dir] [-/ root] [-n inc] [-l|-L lock] [-m\nbytes] [-d bytes] [-o n] [-p n] [-f bytes] [-c bytes] [-t seconds] prog",
    "sections": {
        "NAME": {
            "content": "chpst - runs a program with a changed process state\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "chpst  [-vVP012]  [-u user] [-U user] [-b argv0] [-e dir] [-/ root] [-n inc] [-l|-L lock] [-m\nbytes] [-d bytes] [-o n] [-p n] [-f bytes] [-c bytes] [-t seconds] prog\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "prog consists of one or more arguments.\n\nchpst changes the process state according to the given options, and runs prog.\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "",
            "subsections": [
                {
                    "name": "-u",
                    "content": "setuidgid.  Set uid and gid to the user's uid and gid, as found  in  /etc/passwd.   If\nuser  is  followed  by  a  colon  and a group, set the gid to group's gid, as found in\n/etc/group, instead of user's gid.  If group consists of  a  colon-separated  list  of\ngroup  names, chpst sets the group ids of all listed groups.  If user is prefixed with\na colon, the user and all group arguments are interpreted  as  uid  and  gids  respec‐\ntively,  and  not  looked up in the password or group file.  All initial supplementary\ngroups are removed.\n",
                    "flag": "-u"
                },
                {
                    "name": "-U",
                    "content": "envuidgid.  Set the environment variables $UID and $GID to the user's uid and gid,  as\nfound  in  /etc/passwd.   If  user is followed by a colon and a group, set $GID to the\ngroup's gid, as found in /etc/group, instead of user's gid.  If user is prefixed  with\na colon, the user and group arguments are interpreted as uid and gid respectively, and\nnot looked up in the password or group file.\n",
                    "flag": "-U"
                },
                {
                    "name": "-b",
                    "content": "argv0.  Run prog with argv0 as the 0th argument.\n",
                    "flag": "-b"
                },
                {
                    "name": "-e",
                    "content": "If  dir  contains  a file named k whose first line is v, chpst removes the environment\nvariable k if it exists, and then adds the environment variable k with  the  value  v.\nThe name k must not contain =.  Spaces and tabs at the end of v are removed, and nulls\nin v are changed to newlines.  If the file k is empty (0 bytes  long),  chpst  removes\nthe environment variable k if it exists, without adding a new variable.\n\n-/ root\nchroot.  Change the root directory to root before starting prog.\n",
                    "flag": "-e"
                },
                {
                    "name": "-n",
                    "content": "may start with a minus or plus.\n",
                    "flag": "-n"
                },
                {
                    "name": "-l",
                    "content": "lock.  Open the file lock for writing, and obtain an exclusive lock on it.  lock  will\nbe  created  if it does not exist.  If lock is locked by another process, wait until a\nnew lock can be obtained.\n",
                    "flag": "-l"
                },
                {
                    "name": "-L",
                    "content": "The same as -l, but fail immediately if lock is locked by another process.\n",
                    "flag": "-L"
                },
                {
                    "name": "-m",
                    "content": "limit memory.  Limit the data segment, stack segment, locked physical pages, and total\nof all segment per process to bytes bytes each.\n",
                    "flag": "-m"
                },
                {
                    "name": "-d",
                    "content": "limit data segment.  Limit the data segment per process to bytes bytes.\n",
                    "flag": "-d"
                },
                {
                    "name": "-o",
                    "content": "",
                    "flag": "-o"
                },
                {
                    "name": "-p",
                    "content": "",
                    "flag": "-p"
                },
                {
                    "name": "-f",
                    "content": "limit output size.  Limit the output file size to bytes bytes.\n",
                    "flag": "-f"
                },
                {
                    "name": "-c",
                    "content": "limit core size.  Limit the core file size to bytes bytes.\n",
                    "flag": "-c"
                },
                {
                    "name": "-t",
                    "content": "limit CPU time.  Limit CPU time to seconds seconds, delivering a SIGXCPU thereafter.\n",
                    "flag": "-t"
                },
                {
                    "name": "-v",
                    "content": "its unsupported by the system.\n",
                    "flag": "-v"
                },
                {
                    "name": "-V",
                    "content": "",
                    "flag": "-V"
                },
                {
                    "name": "-P",
                    "content": "",
                    "flag": "-P"
                },
                {
                    "name": "-0",
                    "content": "",
                    "flag": "-0"
                },
                {
                    "name": "-1",
                    "content": "",
                    "flag": "-1"
                },
                {
                    "name": "-2",
                    "content": "",
                    "flag": "-2"
                }
            ]
        },
        "EXIT CODES": {
            "content": "chpst exits 100 when called with wrong options.  It prints an error message and exits 111  if\nit  has  trouble  changing the process state.  Otherwise its exit code is the same as that of\nprog.\n",
            "subsections": []
        },
        "EMULATION": {
            "content": "If chpst is called as envdir, envuidgid, pgrphack, setlock, setuidgid, or softlimit, it  emu‐\nlates the functionality of these programs from the daemontools package respectively.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "sv(8), runsv(8), setsid(2), runit(8), runit-init(8), runsvdir(8), runsvchdir(8)\n\nhttp://smarden.org/runit/\nhttp://cr.yp.to/daemontools.html\n",
            "subsections": []
        },
        "AUTHOR": {
            "content": "Gerrit Pape <pape@smarden.org>\n\n\n\nchpst(8)",
            "subsections": []
        }
    },
    "summary": "chpst - runs a program with a changed process state",
    "flags": [
        {
            "flag": "-u",
            "long": null,
            "arg": null,
            "description": "setuidgid. Set 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 respec‐ tively, and not looked up in the password or group file. All initial supplementary groups are removed."
        },
        {
            "flag": "-U",
            "long": null,
            "arg": null,
            "description": "envuidgid. Set 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."
        },
        {
            "flag": "-b",
            "long": null,
            "arg": null,
            "description": "argv0. Run prog with argv0 as the 0th argument."
        },
        {
            "flag": "-e",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-n",
            "long": null,
            "arg": null,
            "description": "may start with a minus or plus."
        },
        {
            "flag": "-l",
            "long": null,
            "arg": null,
            "description": "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."
        },
        {
            "flag": "-L",
            "long": null,
            "arg": null,
            "description": "The same as -l, but fail immediately if lock is locked by another process."
        },
        {
            "flag": "-m",
            "long": null,
            "arg": null,
            "description": "limit memory. Limit the data segment, stack segment, locked physical pages, and total of all segment per process to bytes bytes each."
        },
        {
            "flag": "-d",
            "long": null,
            "arg": null,
            "description": "limit data segment. Limit the data segment per process to bytes bytes."
        },
        {
            "flag": "-o",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-p",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-f",
            "long": null,
            "arg": null,
            "description": "limit output size. Limit the output file size to bytes bytes."
        },
        {
            "flag": "-c",
            "long": null,
            "arg": null,
            "description": "limit core size. Limit the core file size to bytes bytes."
        },
        {
            "flag": "-t",
            "long": null,
            "arg": null,
            "description": "limit CPU time. Limit CPU time to seconds seconds, delivering a SIGXCPU thereafter."
        },
        {
            "flag": "-v",
            "long": null,
            "arg": null,
            "description": "its unsupported by the system."
        },
        {
            "flag": "-V",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-P",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-0",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-1",
            "long": null,
            "arg": null,
            "description": ""
        },
        {
            "flag": "-2",
            "long": null,
            "arg": null,
            "description": ""
        }
    ],
    "examples": [],
    "see_also": [
        {
            "name": "sv",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/sv/8/json"
        },
        {
            "name": "runsv",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runsv/8/json"
        },
        {
            "name": "setsid",
            "section": "2",
            "url": "https://www.chedong.com/phpMan.php/man/setsid/2/json"
        },
        {
            "name": "runit",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runit/8/json"
        },
        {
            "name": "runit-init",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runit-init/8/json"
        },
        {
            "name": "runsvdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runsvdir/8/json"
        },
        {
            "name": "runsvchdir",
            "section": "8",
            "url": "https://www.chedong.com/phpMan.php/man/runsvchdir/8/json"
        }
    ]
}