centos daemon make and install
【编译】 www.zhishiwu.com
centos
1.先到libtlpi目录下,make 编译出ename.c.inc;复制到cksettling目录下;
2.结算编译环境需要64bit的libmysql库:把libmysql.so.16 所在路径加入到 /var/ld.so.conf 中,执行 ldconfig;
3、配置 ./configure –refix=/usr/local/cksettling //指定安装目录,以后要删除安装就只需删除这个目录。
4、编译和安装
修改makefile 和subdir.mk 中的输出文件和库文件路径,
make clean && make install
复制cksettling.conf到安装目录 cp cksettling.conf /usr/local/cksettling/.
5、编写启动脚本,把它放到目录 /etc/rc.d/init.d/里,这里取名为cksettlingd,其内容如下
//////////////////////////////
例如脚本名称为cksettlingd
#!/bin/bash
#chkconfig 2345 99 80
# description: cksettlingd is a settling service.
#上面为固定格式:2345 表示运行级别,99表示开机执行顺序,80为关机顺序
# 没有上面的就会提示 does not support chkconfig
www.zhishiwu.com
# cking settling service.
# author :zhangshiguang
# time:2012.12.09 PM
# description: a application server
# usage:
#chkconfig --list|grep cksettling
#chkconfig --add cksettling
#chkconfig --levels 235 cksettling on
#chkconfig --del cksettling
case "$1" in
start)
/usr/local/cking/sbin/cksettling
echo "cksettling start ok"
;;
restart)
kill -HUP `ps aux | grep cksettling | grep -v grep | awk '{print $2}'`
echo "cksettling restart ok"
;;
stop)
kill -TERM `ps aux | grep cksettling | grep -v grep | awk '{print $2}'`
echo "cksettling stop ok"
;;
esac
exit 0
/////////////////////////
别忘了给它赋予可执行权限:
chmod a+x /etc/rc.d/init.d/cksettlingd
//////////////////////////////
查看系统日志 gedit /var/log/syslog
centos 系统日志在 /var/log/messages