centos6.6中service启动gearman服务

#!/bin/bash # chkconfig: - 85 15 #descrīption: service(/usr/local/gearmand-1.1.12/sbin/gearmand). /etc/rc.d/init.d/functionsstart() { echo -n $"Starting $prog" echo -e " gearman :[确定]" /usr/local/gearmand-1.1.12/sbin/gearmand & sleep 1 echo -e "running..." } stop() { echo -n $"Stopping $prog" echo -e " gearman :[确定]" kill -9 `ps -ef | grep "/usr/local/gearmand-1.1.12/sbin/gearmand" | awk '{print $2}' | awk 'NR==1'` sleep 1 echo -e "stoped" }case "$1" in start) start ; ; stop) stop ; ; restart) stop start ; ; status) ps -ef | grep "/usr/local/gearmand-1.1.12/sbin/gearmand" ; ; *) echo $"Usage: $prog {start|stop|restart|status}" >&2 exit 1 ; ; esacexit 0

【centos6.6中service启动gearman服务】因为要跑到安装目录去启动gearman服务,所以今晚自给写了个service启动gearman脚本,如上(初次写服务脚本没有多大经验,见谅)
将脚本拷贝到/etc/init.d/目录下面,然后chkconfig --add gearmand
chkconfig --list或者ntsysv可以看到gearman服务


用sudo service gearmand start即可启动

    推荐阅读