`
guoyunsky
  • 浏览: 839136 次
  • 性别: Icon_minigender_1
  • 来自: 上海
博客专栏
3d3a22a0-f00f-3227-8d03-d2bbe672af75
Heritrix源码分析
浏览量:203198
Group-logo
SQL的MapReduce...
浏览量:0
社区版块
存档分类
最新评论

CentOS下安装start-stop-daemon

阅读更多

    微博:http://weibo.com/guoyunwb

 

    start-stop-daemon是一个很优秀的后台运行管理程序,采用C开发。之前一直通过启动程序后将pid写入一个文件,之后再通过kill这个文件里进程号来达到关闭这个程序的目的,具体代码如下:

   

# 后台启动程序
nohup ./start-daemon.sh > nohup.out &
# 将进程写到指定pid文件
echo $! > "${PID_FILE}"
# 强制关闭该程序
kill -9 `cat ${PID_FILE}`

    后来发现不少程序都通过start-stop-daemon来实现这个功能,并且提供了灵活的配置,于是也开始使用start-stop-daemon.

    Ubuntu上使用start-stop-daemon比较方便,CetnOS就要手动安装下。参照他们的官网http://shriikant.blogspot.com/2011/08/start-stop-daemon-script-for-centos-5.html 去安装发现有些问题,所以这里博客记录下。

     

yum install gcc
cd /tmp
wget http://developer.axis.com/download/distribution/apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
tar zxf apps-sys-utils-start-stop-daemon-IR1_9_18-2.tar.gz
cd apps/sys-utils/start-stop-daemon-IR1_9_18-2/
gcc start-stop-daemon.c -o start-stop-daemon
cp start-stop-daemon /usr/local/bin/start-stop-daemon

    按照他们官网的安装方法,使用make直接编译会报以下错误:

     Makefile:2: /tools/build/Rules.axis: No such file or directory

     make: *** No rule to make target `/tools/build/Rules.axis'.  Stop.

     后来发现里面就一个start-stop-daemon.c文件,于是试着用gcc编译了下,发现可以执行。于是就直接编译了。

 

更多技术文章、感悟、分享、勾搭,请用微信扫描:

0
3
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics