登录  
 加关注
查看详情
   显示下一条  |  关闭
温馨提示!由于新浪微博认证机制调整,您的新浪微博帐号绑定已过期,请重新绑定!立即重新绑定新浪微博》  |  关闭

SeaRiver Blog

实力才是你一生最好的依靠!

 
 
 

日志

 
 

Service monitoring with daemontools  

2010-06-08 16:52:18|  分类: daemontools |  标签: |举报 |字号 订阅

  下载LOFTER 我的照片书  |

Service monitoring with daemontools

This is a reference for setting up various daemons (services) under djb's excellent daemontools package, which provides tools for the supervision, monitoring, and control of system processes, as well as an assortment of other useful utilities. Some of these scripts make use of software included in djb's ucspi-tcp package.

The rationale for using daemontools and ucspi-tcp is available on djb's site. Suffice it to say that any competent systems engineer will immediately recognize the benefits of these packages.

I recommend the use of /var/spool/supervise to contain supervise directories. I've seen /etc/supervise used as well.

Shameless plug: I am available to set up any of this software on either a full-time employment or consulting/contracting basis. Feel free to inquire.

Shell scripts (run) for various services:

syslogd
#!/bin/sh  exec 2>&1  exec /usr/sbin/syslogd -n      
klogd
#!/bin/sh  exec 2>&1  exec /usr/sbin/klogd -n      
sshd (OpenSSH)
#!/bin/sh  exec 2>&1  exec /usr/local/sbin/sshd -D -e      
crond
#!/bin/sh  exec 2>&1  exec /usr/sbin/crond -l10 -f      
httpd (Apache)
#!/bin/sh  exec 2>&1  exec /usr/local/apache/bin/httpd -F      
dnscache
#!/bin/sh  exec 2>&1  exec <seed  exec /usr/local/bin/envdir ./env sh -c '    exec /usr/local/bin/envuidgid dnscache \      /usr/local/bin/softlimit -o250 -d "$DATALIMIT" \      /usr/local/bin/dnscache  '      
tinydns
#!/bin/sh  exec 2>&1  exec /usr/local/bin/envuidgid tinydns \    /usr/local/bin/envdir ./env \    /usr/local/bin/softlimit -d300000 \    /usr/local/bin/tinydns      
pure-ftpd
#!/bin/sh  exec 2>&1  exec /usr/local/sbin/pure-ftpd -C 2 -E -d -4 -H -k 95 -u 100 -f none      
mysqld
#!/bin/sh  exec 2>&1  exec /usr/local/mysql/libexec/mysqld -u mysql      
postmaster (PostgreSQL)
#!/bin/sh  exec 2>&1  PREFIX=/usr/local/pgsql  exec /usr/local/bin/setuidgid postgres \    $PREFIX/bin/postmaster -i -D $PREFIX/data      
spamd (SpamAssassin)
#!/bin/sh  exec 2>&1  exec /usr/local/bin/spamd      
ntpd
#!/bin/sh  exec 2>&1  exec /usr/local/bin/ntpd -n      
imapd (Courier)
#!/bin/sh  exec 2>&1  PREFIX=/usr/local/courier  exec /usr/local/bin/envdir ./env \    /usr/local/bin/tcpserver -v -R -H 0 143 \    $PREFIX/sbin/imaplogin $PREFIX/libexec/authlib/authshadow \    $PREFIX/bin/imapd Maildir      
imapd-ssl (Courier)
#!/bin/sh  exec 2>&1  PREFIX=/usr/local/courier  exec /usr/local/bin/envdir ./env \    /usr/local/bin/tcpserver -v -R -H 0 993 \    $PREFIX/bin/couriertls -server \    -tcpd $PREFIX/sbin/imaplogin \    $PREFIX/libexec/authlib/authshadow \    $PREFIX/bin/imapd Maildir      
webproxy (micro_proxy)
#!/bin/sh  exec 2>&1  exec /usr/local/bin/setuidgid webproxy \    /usr/local/bin/tcpserver -v -H -R 0 44444 \    /usr/local/bin/micro_proxy      
spam-stats
#!/bin/sh  exec 2>&1  exec /usr/local/bin/setuidgid spam-stats \    /usr/local/bin/tcpserver -v -H -R 0 7300 \    /usr/local/sbin/spamstats-stage1.pl      
in.telnetd
#!/bin/sh  exec 2>&1  exec /usr/local/bin/tcpserver -v -R -H \    -x telnetd/tcp.telnet.cdb 0 23 \    /usr/sbin/in.telnetd      
inetd
#!/bin/sh  exec 2>&1  exec /usr/local/bin/fghack /usr/sbin/inetd      
dhcpd
#!/bin/sh  exec 2>&1  exec /usr/sbin/dhcpd -f eth1      
pptpd (PoPToP)
#!/bin/sh  exec 2>&1  exec /usr/local/bin/pptpd -c /etc/pptpd.conf -f -l 10.1.1.1      

Scripts to set up supervise directories:

makedir
#!/bin/bash    if [ "$2" == "" ]; then    echo -e "\nUsage: $0 dir loguser\n";    exit 100  fi    mkdir -p $1/log/main  chown $2 $1/log/main    echo -e "#!/bin/sh\nexec 2>&1" > $1/run  echo -e "#!/bin/sh\nexec setuidgid $2 multilog t ./main" > $1/log/run    chmod 0755 $1/run $1/log/run      
makedir-auto
#!/bin/bash    if [ "$3" == "" ]; then    echo -e "\nUsage: $0 dir loguser runcmd\n";    exit 100  fi    mkdir -p $1/log/main  chown $2 $1/log/main    echo -e "#!/bin/sh\nexec 2>&1\nexec $3" > $1/run  echo -e "#!/bin/sh\nexec setuidgid $2 multilog t ./main" > $1/log/run    chmod 0755 $1/run $1/log/run  ln -s /var/spool/supervise/$1 /service      
  评论这张
 
阅读(531)| 评论(0)

历史上的今天

在LOFTER的更多文章

评论

<#--最新日志,群博日志--> <#--推荐日志--> <#--引用记录--> <#--博主推荐--> <#--随机阅读--> <#--首页推荐--> <#--历史上的今天--> <#--被推荐日志--> <#--上一篇,下一篇--> <#-- 热度 --> <#-- 网易新闻广告 --> <#--右边模块结构--> <#--评论模块结构--> <#--引用模块结构--> <#--博主发起的投票-->
 
 
 
 
 
 
 
 
 
 
 
 
 
 

页脚

网易公司版权所有 ©1997-2018