udon / README

udon: easy to use daemon manager

udon is a easy to use daemon manager. It runs as a daemon and run other
programs, log outputs, and restart if program exited.

There are many tools like Sysv-init, rc, upstert, daemontool, etc. to control daemons.
But they are tools for admins to control system services.

udon is tool for normal users to run their programs for a while.


Features
========

- Register command as a daemon
- Show list of registered daemons
- Show daemon's info
- Start daemon
- Stop daemon
- Send signals to daemon
- Log daemon's output
- Rotate log by size
- Restart daemon if exited
- Stop restarting if daemon start and stop quickly


Install
=======

Run following commands::

  $ runghc Setup.lhs configure --user
  $ runghc Setup.lhs build
  $ runghc Setup.lhs install --user

if you have "cabal" command, simply run ``cabal install``.


Setup
=====

``udon`` command start ``udon-master`` (master process that manage daemons) if
there is no ``udon-master``, so no start-up script is needed.

If you want to start ``udon-master`` at system boot time, you can use cron to
execute "udon ping > /dev/null" periodically. It start ``udon-master`` at first
call, do nothing other times.


Usage
=====

1. Register command

   At first, you should register command with ``udon register`` subcommand::

     $ udon register command you want to run as daemon
     OK

   ``udon register`` save command, arguments, environmental variables and
   current working directory.

   .. CAUTION::

      command *should* run in foreground.

      if command daemonize itself, udon seems command exited and restart it,
      even if command not actually exited.

2. View list of daemons

   Now, your command is registered. You can view command name in ``udon list``::

     $ udon list
     DAEMON               STATUS
     command              not started

3. Start daemon

   To start daemon, you use ``udon start``::

     $ udon start command
     OK
     $ udon list
     DAEMON               STATUS
     command              running (pid: 6003) 00:00:01

4. View daemon's output

   To view daemon's output, you use ``udon tail``::

     $ udon tail command
     [2010-02-28 22:01:44.050772 JST] output
     [2010-02-28 22:01:47.051475 JST] of
     [2010-02-28 22:01:50.052196 JST] your
     [2010-02-28 22:01:53.053022 JST] command

   or use ``udon less`` to view entire log.

   Log is stored at ``~/.udon/log/<daemon>.log``. 

5. Send signal to daemon

   If you want to send signal to daemon, use ``udon kill``::

     $ udon kill command
     OK
     $ udon list
     DAEMON               STATUS
     command              running (pid: 6039) 00:00:01

   command killed and restarted automatically.

6. Stop daemon

   If you want to stop daemon, use ``udon stop``::

     $ udon stop command
     OK
     $ udon list
     DAEMON               STATUS
     command              terminated (by signal 15)

   ``udon stop`` send TERM signal to stop command, and do *not* restart it.

There are some more subcommands. Run ``udon help`` to see all commands.
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.