# phpman > man > chpst(8)

[chpst(8)](https://www.chedong.com/phpMan.php/man/chpst/8/markdown)                               System Manager's Manual                              [chpst(8)](https://www.chedong.com/phpMan.php/man/chpst/8/markdown)



## NAME
       chpst - runs a program with a changed process state

## SYNOPSIS
       **chpst**  [-vVP012]  [-u _user_] [-U _user_] [-b _argv0_] [-e _dir_] [-/ _root_] [-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.

       **chpst** changes the process state according to the given options, and runs _prog_.

## OPTIONS
### -u
              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.

### -U
              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.

### -b
              argv0.  Run _prog_ with _argv0_ as the 0th argument.

### -e
              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_.

### -n
              may start with a minus or plus.

### -l
              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
              The same as -l, but fail immediately if _lock_ is locked by another process.

### -m
              limit memory.  Limit the data segment, stack segment, locked physical pages, and total
              of all segment per process to _bytes_ bytes each.

### -d
              limit data segment.  Limit the data segment per process to _bytes_ bytes.

### -o

### -p

### -f
              limit output size.  Limit the output file size to _bytes_ bytes.

### -c
              limit core size.  Limit the core file size to _bytes_ bytes.

### -t
              limit CPU time.  Limit CPU time to _seconds_ seconds, delivering a SIGXCPU thereafter.

### -v
              its unsupported by the system.

### -V

### -P

### -0

### -1

### -2

## 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_.

## EMULATION
       If **chpst** is called as **envdir**, **envuidgid**, **pgrphack**, **setlock**, **setuidgid**, or **softlimit**, it  emu‐
       lates the functionality of these programs from the daemontools package respectively.

## SEE ALSO
       [sv(8)](https://www.chedong.com/phpMan.php/man/sv/8/markdown), [runsv(8)](https://www.chedong.com/phpMan.php/man/runsv/8/markdown), [setsid(2)](https://www.chedong.com/phpMan.php/man/setsid/2/markdown), [runit(8)](https://www.chedong.com/phpMan.php/man/runit/8/markdown), [runit-init(8)](https://www.chedong.com/phpMan.php/man/runit-init/8/markdown), [runsvdir(8)](https://www.chedong.com/phpMan.php/man/runsvdir/8/markdown), [runsvchdir(8)](https://www.chedong.com/phpMan.php/man/runsvchdir/8/markdown)

        <http://smarden.org/runit/>
        <http://cr.yp.to/daemontools.html>

## AUTHOR
       Gerrit Pape <<pape@smarden.org>>



                                                                                            [chpst(8)](https://www.chedong.com/phpMan.php/man/chpst/8/markdown)
