herd command is a generic client program to control a
running instance of
shepherd (see Invoking shepherd).
When running as root, it communicates with the system
instance—the process with PID 1; when running as a normal user,
it communicates with the user’s instance, which is a regular,
unprivileged process managing the user’s own services. For example, the
following command displays the status of all the system services:
sudo herd status
Conversely, the command below displays the status of user
services, assuming a user
shepherd is running:
The command has the following synopsis:
herd [option…] action [service [arg…]]
It causes the action of the service to be invoked. When
service is omitted and action is
root service is used3 (see The root and unknown services, for
more information on the
For each action, you should pass the appropriate args. Actions
that are available for every service are
If you pass a file name as an arg, it will be passed as-is to
the Shepherd, thus if it is not an absolute name, it is local to the current
working directory of
shepherd, not to herd.
herd command understands the following option:
Send commands to the socket special file file. If this option is not specified, localstatedir/run/shepherd/socket is taken.
herd command returns zero on success, and a non-zero exit
code on failure. In particular, it returns a non-zero exit code when
action or service does not exist and when the given action
shorthand does not work for other actions such as
herd stop would stop all the services, which
could be pretty annoying.