daemontools manage UNIX services and script

daemontools is a collection of tools for managing UNIX services.

supervise monitors a service. It starts the service and restarts the service if it dies. Setting up a new service is easy: all supervise needs is a directory with a run script that runs the service.

multilog saves error messages to one or more logs. It optionally timestamps each line and, for each log, includes or excludes lines matching specified patterns. It automatically rotates logs to limit the amount of disk space used. If the disk fills up, it pauses and tries again, without losing any data.


1.Install

     mkdir -p package
     chmod 1755 package
     cd package

Download  daemontools-0.76.tar.gz  into  package .

 wget http://cr.yp.to/daemontools/daemontools-0.76.tar.gz
Unpack the daemontools package:

tar zxvf daemontools-0.76.tar.gz
cd admin/daemontools-0.76
Compile and set up the daemontools programs:

package/install

Error.If you get an error informations such as this:

/usr/bin/ld: errno: TLS definition in /lib/libc.so.6 section .tbss mismatches non-TLS reference in [...]

slove problem:

1)edit src/conf-cc 

add "-include /usr/include/errno.h" on the end of first line.also,you can run this command on directory package/admin/daemontoos-0.76

sed -i '/gcc/s/$/ -include \/usr\/include\/errno.h/' src/conf-cc

2)find the /usr/include/errno.h,and replace the line:

extern int errno;

with

#include <errno.h>

you can run this command automatic:

sed -i '/extern int errno;$/s/extern int errno;/#include <errno.h>/' /usr/include/errno.h


start daemontools with system start:

tow ways:

1)apt-get install csh

/etc/rc.local

Put the line

     csh -cf '/command/svscanboot &'
at the end of  /etc/rc.local .

2)don't install csh

put the line

 sh -c '/command/svscanboot &'

2.use supervise program

my script path: ~/test/run

user this command:

supervise ~/test &
the script name must be "run"







你可能感兴趣的:(daemontools)