service-control 1 user commands nosh
service-control svc control services through their supervision directory API
`service-control` commands directories `svc` commands directories

## Description

`service-control` sends a series of control commands to services that are being managed by service-manager 1, runit's runsv 1, s6's s6-supervise 1, daemontools' supervise 1, or daemontools-encore's supervise 1. Each of the directories is either a supervise directory (see service-bundle 5) itself or a directory with a supervise directory named `supervise` within it.

The control commands are determined by command line options given to `service-control`. Commands are sent in first to last order of the options passed to `service-control`, and each service is given all commands at once before going onto the next.

### COMMANDS

--up

  Send a 'u' command to bring the service up, if it is not already.

--down

  Send a 'd' command to bring the service down, if it is not already. The service is unpaused.

--once

  Send a 'o' command to bring the service up, in one-shot mode.

--at-most-once

  Send a 'O' command to turn on one-shot mode if the service is running. (This command will not be recognized by daemontools' supervise 1 or by runit's runsv 1.)

--exit

  Send a 'x' command to cause the service to be unloaded when it reaches the stopped state.

--pause

  Send a 'p' command to send a SIGSTOP signal to the service.

--continue

  Send a 'c' command to send a SIGCONT signal to the service.

--hangup

  Send a 'h' command to send a SIGHUP signal to the service.

--hangup-main

  Send a 'H' command to send a SIGHUP signal to only the main process of the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, or by s6's s6-supervise 1.)

--alarm

  Send a 'a' command to send a SIGALRM signal to the service.

--interrupt

  Send a 'i' command to send a SIGINT signal to the service.

--terminate

  Send a 't' command to send a SIGTERM signal to the service.

--terminate-main

  Send a 'T' command to send a SIGTERM signal to only the main process of the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, or by s6's s6-supervise 1.)

--kill

  Send a 'k' command to send a SIGKILL signal to the service.

--kill-main

  Send a 'K' command to send a SIGKILL signal to only the main process of the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, or by s6's s6-supervise 1.)

--quit

  Send a 'q' command to send a SIGQUIT signal to the service. (This command will not be recognized by daemontools' supervise 1 or by s6's s6-supervise 1.)

--usr1

  Send a '0' command to send a null signal to the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, or by s6's s6-supervise 1.)

  Send a '1' command to send a SIGUSR1 signal to the service. (This command will not be recognized by daemontools' supervise 1.)

--usr2

  Send a '2' command to send a SIGUSR2 signal to the service. (This command will not be recognized by daemontools' supervise 1.)

--window

  Send a 'w' command to send a SIGWINCH signal to the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, or by s6's s6-supervise 1.)

--suspend

  Send a 'z' command to send a SIGTSTP signal to the service. (This command will not be recognized by daemontools' supervise 1, by runit's runsv 1, by s6's s6-supervise 1, or by daemontools-encore's supervise 1.)

## Compatibility

For daemontools and daemontools-encore compatibility, this command is also available as `svc`; and the options are also available in the abbreviated forms -u, -d, and so forth.

There is a subtle difference in the `--exit` option, resulting from the differences in service architecture.

- daemontools' and daemontools-encore's svc 1 manuals note that using their `-x` is almost always wrong. It causes the supervising process(es) to themselves exit; however the supervisor that supervises them will usually then restart them, resulting in the service being automatically restarted.

- The `exit` option in runit's runsv 1 is curtailed relative to the original daemontools because of differences in the structure of runit. It does not respect requests for log services to exit.

  It also explicitly takes the services down if they are up, which is not the case with daemontools and daemontools-encore.

- `service-control`'s `--exit` option does not cause service-manager 1 to exit, since it is not the way that service-manager 1 operates. It only applies to the services actually specified; log services must be treated as first class services in their own rights and explicitly specified. Since the supervising process isn't restarted (it not exiting in the first place), services are not auto-reloaded as a by-product of that; exiting does not cause an auto-restart.

## Author

Jonathan de Boyne Pollard