cpsv(8)

NAME
cpsv - utility to install and manage runit services

SYNOPSIS
cpsv [-f] a <service-directory> [ <service-directory2> ...]
cpsv p <service-directory> [ <service-name> ]
cpsv d <service-directory> [ <service-name> ]
cpsv [-f] s
cpsv l

DESCRIPTION
cpsv is a tool to install runscripts from CPSV_SOURCE to CPSV_DEST. It can also be used to manage runscripts that are already installed in CPSV_DEST.
In a Debian system, by default, CPSV_SOURCE is /usr/share/runit/sv.src and CPSV_DEST is /etc/sv. Deb packages install runscripts in /usr/share/runit/sv and a runitme copy of each relevant service is maintained at /usr/share/runit/sv.current. By default sv.src is a symlink that points to /usr/share/runit/sv.
When a runscript is installed in /usr/share/runit/sv/, /etc/sv/ becomes reserved for a locally modified copy of the service.

COMMANDS

a   Copy <service> from CPSV_SOURCE into CPSV_DEST, then create symlinks as when the p command is used; more than one <service> name can be given with this command and each <service> directory must exists in CPSV_SOURCE.
    If <service> already exists in CPSV_DEST, cpsv prints a warning, the cp invocation is skipped and the return code is increased by one. The -f option can be used to change this behaviour.

p   Copy <service-directory> in the <sv.current> runtime directory and create <service-name> in CPSV_DEST, if it does not exists. <service-directory> must exists in CPSV_SRC; if <service-name> is omitted, <service-directory> is used instead. When <p> is invoked without root privileges, <service-directory> must already exists in the runtime <sv.current> directory and the <@user> string in <service-name> , if any, is replaced by <@username>. Then <CPSV_DEST/service-name> is populated with directories and symlinks: <run,check,finish,xchopts,control,.meta,env> and <log/run> are symlinked to their conterpart in /usr/share/runit/sv.current/<service-directory>/; the <CPSV_DEST/service-name/log> directory is created, if needed; files or directories already found in <CPSV_DEST/service-name/ are skipped.
    If a <service-name>/supervise symlink or directory is not found, cpsv creates one. If a <service-name>/.meta/finish file exists, and a <service-name>/finish file or symlink is not found, cpsv creates a symlink to /lib/runit/finish-exec.
    When a <service-name>/log directory exists: if <service-name>/log/supervise link or directory is not found, cpsv creates one; if <service-name>/log/run file or symlink is not found, cpsv creates a symlink to /etc/sv/svlogd/run.

d   Print the diff between the <service-directory> in CPSV_SOURCE and the <service-name> directory in CPSV_DEST. The exit status of diff is returned; <service-directory> must exists in CPSV_SOURCE. If <service-name> is omitted, <service-directory> is used instead. When <p> is invoked without root privileges, <service-directory> must already exists in the runtime <sv.now> directory and the <@user> string in <service-name> , if any, is replaced by <@username>. Supervise , conf and wtime are excluded from the diff.

s   Sync CPSV_DEST with CPSV_SOURCE; for each <service> directory in CPSV_SOURCE cpsv search the system for a systemd or sysv service file with the same name: if it finds one then it copies the <service> directory as when the a command is given and goes to the next directory; else cpsv looks for the path written in a <service>/.meta/bin file, and if such path exists in the system then it copies the <service> directory as when the a command is given; otherwise it goes to the next directory.

l   List installed services in CPSV_DEST; the name of each <service> that would be copied with the s command is printed, preceded with character surronded by square brakets;
    [a]: <service>;
     exists in CPSV_SOURCE but not in CPSV_DEST
    [i]: <service>;
     exists both in CPSV_SOURCE and CPSV_DEST, the copy in CPSV_DEST is identical
     to the one created with the a command
    [l]: <service>;
     exists both in CPSV_SOURCE and CPSV_DEST, the copy in CPSV_DEST is different
     from the one created with the a command

OPTIONS

-f  Overwrite <service> files in CPSV_DEST with <service> files in CPSV_SOURCE, no backup is provided. When a <service>/log directory exists, the <service>/log/run file or symlink is replaced with the default one that is created with the p command; supervise directories or symlinks are never overwritten or replaced this way.

ENVIRONMENT

CPSV_DEST
    The environment variable $CPSV_DEST overrides the default directory where services are copied. If omitted or empty, the default is /etc/sv; when cpsv is run without root privileges, the default value is set to ~/.runit/sv

CPSV_SOURCE
    The environment variable $CPSV_SOURCE overrides the default directory from where services are copied. If omitted or empty, the default is /usr/share/runit/sv.src. By changing the target of the /usr/share/runit/sv.src symlink it is possible to permanently override CPSV_SOURCE to use a local colletion of runscripts. When cpsv is run without root privileges, the default value is set to /usr/share/runit/sv.current.

AUTHOR
Lorenzo Puliti <plorenzo@disroot.org>

SEE ALSO
update-service(8)