码迷,mamicode.com
首页 > 其他好文 > 详细

daemontools manage UNIX services and script

时间:2015-02-28 18:42:45      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:daemontools

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 manage UNIX services and script

标签:daemontools

原文地址:http://blog.csdn.net/apache0554/article/details/43987683

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!