Daemon Tools Jr.

Daemon Tools Jr.
Version:0.1
Author:Jeffrey Clement
Status:Stable

A really simple set of programs for maintaining services on a Unix machine. Like a very, very, light weight version of DJB's Daemon Tools.

Project Description

1. svrun

This quick utility is used to run a service in the background and make sure it stays running. It's very simple. You provide it a program, and arguments on the command line and it runs that and if it stops, restarts it after 5 seconds. It forks and prints out the process ID of the controlling svrun process. That's it. ie)

$ svrun python2.2 MainServer.py
8001
$ ps aux | grep python2.2
jsc       8001  0.0  0.1  1352  268 pts/8    S    18:04   0:00 ./svrun python2.2 MainServer.py
jsc       5303  0.0  0.2  1892  460 pts/8    S    18:05   0:00 python2.2 MainServer.py
$ kill 5303
$ ps aux | grep python2.2
jsc       8001  0.0  0.1  1352  268 pts/8    S    18:04   0:00 ./svrun python2.2 MainServer.py
jsc       5392  0.0  0.2  1892  460 pts/8    S    18:05   0:00 python2.2 MainServer.py
$ kill 8001
$ ps aux | grep python2.2

When you kill the controller process the child process also dies.

There are quite a few problems with this script that should be taken into account:

  1. stdin/stdout for your program are the launching stdin/stdout - this is almost always wrong. hopefully your service takes care of its own logging
  2. it doesn't handle switching userIDs or anything fancy like that. Sometimes this is probably a bad thing.

Links

License

This software is licensed under the BSD license. Please make sure you have read and understood this license before downloading this software!

Copyright (c) 2003, Jeffrey Clement All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Downloads

FileSizeLast Modified
ChangeLog0.00 kbThu Sep 23 05:52:27 2004
daemon-tools-jr-0.1-src.tar.gz3.46 kbThu Sep 23 05:52:27 2004
daemon-tools-jr-0.1-src.tar.gz.asc0.18 kbThu Sep 23 05:52:27 2004
daemon-tools-jr-snapshot.tar.gz3.46 kbThu Sep 23 05:52:27 2004