/arch-daemon

Manipulate daemons (services) more easily in Arch Linux

Primary LanguageShellISC LicenseISC

ARCH-DAEMON (SHORT: DAEMON) README
===============================================================================

**(Arch-)Daemon** manipulates services on an Arch Linux system.

Lets say I like to start or stop daemons manually a lot, for example if I
never use `cups` or `httpd` or `mysqld`. Normally I'd have to then do this:

    sudo /etc/rc.d/cups start
    sudo /etc/rc.d/httpd start
    sudo /etc/rc.d/mysqld start

It would be nice if we could simplify this, and indeed, this is the niche
that **Arch-Daemon** tries to fill. With Arch-Daemon we can then do this:

    sudo daemon cups httpd mysqld

and all of those services will be started in exactly the same way that we
did it above.

Arch-Daemon is distributed under the ISC License (see `LICENSE`).


### Usage (taken from `daemon --help`)

    Usage: daemon [options] [command] <daemons>
    Available options:
    --command cmd  -c   send the given command
    --fail         -f   quit when a service does not exist
                        or when a service quits with an error
    --list         -l   list started daemons and quit
    --available    -a   list all available daemons and quit
    --arguments    -z   list sendable commands to given daemons and quit
                        e.g. daemon -z cups httpd network
    --help         -h   display this help and quit
    --version      -v   display the version and quit

    Any command may be given; if no command is given,
    then `start` is assumed. Some commands have aliases:
      s=start,  t=stop,  r=restart,  l=reload

    If the first argument does not exist in /etc/rc.d as
    a daemon, then it is assumed to be a command.
    If a aliased command exists as a daemon in /etc/rc.d,
    then the command can be send with `-c command`.


### Examples
Start some daemons (these are all equivalent):

    daemon httpd mysqld
    daemon s httpd mysqld
    daemon start httpd mysqld

Restart, stop, reload some daemons:

    daemon r tomcat
    daemon t cups
    daemon l httpd

Send a specfic un-aliased command:

    daemon setup vboxdrv
    daemon -c setup vboxdrv

Get the available commands for some daemons:

    daemon -z cups httpd

... for all the daemons:

    daemon -z /etc/rc.d/*

Fail if anything goes wrong (daemon does not exist, or a daemon does not
support the command that is being sent):

    daemon -f reload httpd mysql


### Tips
I like to make `sudo daemon` run without a password, in which case I can
also make an alias for myself:

    alias daemon="sudo daemon"

Daemon will take the basename of a given daemon, which means that running:

    sudo daemon ../../home/baduser/bad-script.sh

will run `/etc/rc.d/bad-script.sh`. So you cannot execute services outside
of `/etc/rc.d/`. This means you can save yourself even more typing by
letting you run `sudo daemon` without a password! ;)