---
name: "cpsv"
section: "8"
platform: "linux"
package: "runit"
version: "2.2.0-3"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/cpsv"
---

# cpsv(8)

utility to install and manage runit services

## NAME

cpsv - utility to install and manage runit services

## SYNOPSIS

**cpsv**  \[-f\] a *\<service-name\> ...*\
 **cpsv**  p *\<service-name\>*\
 **cpsv**  d *\<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, CPSV\_SOURCE is */usr/share/runit/sv.src* and CPSV\_DEST is */etc/sv*; by default */usr/share/runit/sv.src* is a symlink that points to */usr/share/runit/sv*.\
 Traditionally runscripts are installed in */etc/sv/* but it's also possible to have runscripts installed in */usr/share/runit/sv/*; when the latter is true, */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**

  Populate the *\<service\>* directory with symlinks; a *\<service\>* directory in CPSV\_DEST must already exist.\
   If a *\<service\>/supervise* symlink or directory is not found, cpsv creates one. If a *\<service\>/.meta/finish* file exists, and a *\<service\>/finish* file or symlink is not found, cpsv creates a symlink to */lib/runit/finish-exec.*\
   When a *\<service\>/log* directory exists: if *\<service\>/log/supervise* link or directory is not found, cpsv creates one; if *\<service\>/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 that would be created with the *a* command and the current *\<service\>* directory in CPSV\_DEST. The exit status of diff is returned; a *\<service\>* directory must exists in CPSV\_SOURCE. *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*

- **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*

## AUTHOR

Lorenzo Puliti \<plorenzo@disroot.org\>

## SEE ALSO

[**update-service**(8)](/update-service/8.md)
