{"id":248,"date":"2009-11-06T19:36:00","date_gmt":"2009-11-06T19:36:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=248"},"modified":"2009-11-06T19:36:00","modified_gmt":"2009-11-06T19:36:00","slug":"init-d-script-for-gearmand","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=248","title":{"rendered":"init.d script for gearmand"},"content":{"rendered":"<p><textarea name=\"code\" class=\"xml\"><br \/>\n#!\/bin\/bash<br \/>\n#<br \/>\n# gearmand        Startup script for the Gearman server<br \/>\n#<br \/>\n# chkconfig: &#8211; 85 15<br \/>\n# description: Gearman is a distributed job system.<br \/>\n# processname: gearmand<br \/>\n# config: \/etc\/sysconfig\/gearmand<br \/>\n# pidfile: \/var\/run\/gearmand\/gearmand.pid<br \/>\n#<br \/>\n### BEGIN INIT INFO<br \/>\n# Provides: gearmand<br \/>\n# Required-Start: $local_fs $network<br \/>\n# Required-Stop: $local_fs $network<br \/>\n# Default-Start:<br \/>\n# Default-Stop:<br \/>\n# Short-Description: start and stop the Gearman server<br \/>\n# Description: Gearman is a distributed job system.<br \/>\n### END INIT INFO<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p>if [ -f \/etc\/sysconfig\/gearmand ]; then<br \/>\n        . \/etc\/sysconfig\/gearmand<br \/>\nfi<\/p>\n<p>[ -z &#8220;${PIDFILE}&#8221; ] &#038;&#038; pidfile=&#8221;\/var\/run\/gearmand\/gearmand.pid&#8221;<br \/>\n[ -z &#8220;${LOCKFILE}&#8221; ] &#038;&#038; lockfile=&#8221;\/var\/lock\/subsys\/gearmand&#8221;<\/p>\n<p>gearmand=\/usr\/sbin\/gearmand<br \/>\nprog=gearmand<\/p>\n<p>RETVAL=0<\/p>\n<p>start() {<br \/>\n        echo -n $&#8221;Starting $prog: &#8221;<br \/>\n        daemon &#8211;pidfile=$pidfile &#8211;user=gearmand $gearmand -d $OPTIONS<br \/>\n        RETVAL=$?<br \/>\n        echo<br \/>\n        [ $RETVAL = 0 ] &#038;&#038; (touch $lockfile; pgrep -f $gearmand > $pidfile)<br \/>\n        return $RETVAL<br \/>\n}<\/p>\n<p>stop() {<br \/>\n echo -n $&#8221;Stopping $prog: &#8221;<br \/>\n killproc -p $pidfile $gearmand<br \/>\n RETVAL=$?<br \/>\n echo<br \/>\n [ $RETVAL = 0 ] &#038;&#038; rm -f $lockfile $pidfile<br \/>\n}<\/p>\n<p># See how we were called.<br \/>\ncase &#8220;$1&#8243; in<br \/>\n  start)<br \/>\n start<br \/>\n ;;<br \/>\n  stop)<br \/>\n stop<br \/>\n ;;<br \/>\n  status)<br \/>\n        status -p $pidfile $gearmand<br \/>\n RETVAL=$?<br \/>\n ;;<br \/>\n  restart|reload)<br \/>\n stop<br \/>\n start<br \/>\n ;;<br \/>\n  condrestart|try-restart)<br \/>\n if status -p $pidfile $gearmand >&#038;\/dev\/null; then<br \/>\n  stop<br \/>\n  start<br \/>\n fi<br \/>\n ;;<br \/>\n  *)<br \/>\n echo $&#8221;Usage: $prog {start|stop|restart|reload|condrestart|status|help}&#8221;<br \/>\n RETVAL=3<br \/>\nesac<\/p>\n<p>exit $RETVAL<br \/>\n<\/textarea><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash # # gearmand Startup script for the Gearman server # # chkconfig: &#8211; 85 15 # description: Gearman is a distributed job system. # processname: gearmand # config: \/etc\/sysconfig\/gearmand # pidfile: \/var\/run\/gearmand\/gearmand.pid # ### BEGIN INIT INFO # Provides: gearmand # Required-Start: $local_fs $network # Required-Stop: $local_fs $network # Default-Start: # Default-Stop: # Short-Description: [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[9],"tags":[],"_links":{"self":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/248"}],"collection":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=248"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/248\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}