{"id":247,"date":"2009-11-05T18:38:00","date_gmt":"2009-11-05T18:38:00","guid":{"rendered":"http:\/\/blog.trungson.com\/?p=247"},"modified":"2009-11-05T18:38:00","modified_gmt":"2009-11-05T18:38:00","slug":"init-d-script-for-stunnel-on-centos","status":"publish","type":"post","link":"http:\/\/blog.trungson.com\/?p=247","title":{"rendered":"init.d script for stunnel on CentOS"},"content":{"rendered":"<p>You might need to modify some settings to suite your installation. I installed from source. <\/p>\n<pre>\nwhereis stunnel\n(might need to ln -s \/usr\/local\/bin\/stunnel \/usr\/sbin\/stunnel)\n\nvi \/etc\/init.d\/stunnel\n<\/pre>\n<p><textarea name=\"code\" class=\"xml\"><br \/>\n#!\/bin\/bash<br \/>\n#<br \/>\n# stunnel      This shell script takes care of starting and stopping<br \/>\n#              stunnel<br \/>\n#<br \/>\n# chkconfig: 345 80 30<br \/>\n# description:  Secure tunnel<\/p>\n<p># processname: stunnel<br \/>\n# config: \/etc\/stunnel\/stunnel.conf<br \/>\n# pidfile: \/var\/run\/stunnel\/stunnel.pid<\/p>\n<p># Source function library.<br \/>\n. \/etc\/rc.d\/init.d\/functions<\/p>\n<p># Source stunnel configureation.<br \/>\nif [ -f \/etc\/sysconfig\/stunnel ] ; then<br \/>\n . \/etc\/sysconfig\/stunnel<br \/>\nfi<\/p>\n<p>RETVAL=0<br \/>\nprog=&#8221;stunnel&#8221;<\/p>\n<p>start() {<br \/>\n # Start daemons.<\/p>\n<p> echo -n $&#8221;Starting $prog: &#8221;<br \/>\n if test -x \/usr\/sbin\/stunnel ; then<br \/>\n   \/usr\/sbin\/stunnel \/etc\/stunnel\/stunnel.conf<br \/>\n fi<br \/>\n RETVAL=$?<br \/>\n echo<br \/>\n [ $RETVAL -eq 0 ] &#038;&#038; touch \/var\/lock\/subsys\/stunnel<br \/>\n return $RETVAL<br \/>\n}<\/p>\n<p>stop() {<br \/>\n # Stop daemons.<br \/>\n echo -n $&#8221;Shutting down $prog: &#8221;<br \/>\n killproc stunnel<br \/>\n RETVAL=$?<br \/>\n echo<br \/>\n [ $RETVAL -eq 0 ] &#038;&#038; rm -f \/var\/lock\/subsys\/stunnel<br \/>\n return $RETVAL<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  restart)<br \/>\n stop<br \/>\n start<br \/>\n RETVAL=$?<br \/>\n ;;<br \/>\n  condrestart)<br \/>\n if [ -f \/var\/lock\/subsys\/stunnel ]; then<br \/>\n     stop<br \/>\n     start<br \/>\n     RETVAL=$?<br \/>\n fi<br \/>\n ;;<br \/>\n  status)<br \/>\n status stunnel<br \/>\n RETVAL=$?<br \/>\n ;;<br \/>\n  *)<br \/>\n echo $&#8221;Usage: $0 {start|stop|restart|condrestart|status}&#8221;<br \/>\n exit 1<br \/>\nesac<\/p>\n<p>exit $RETVAL<\/p>\n<p><\/textarea><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You might need to modify some settings to suite your installation. I installed from source. whereis stunnel (might need to ln -s \/usr\/local\/bin\/stunnel \/usr\/sbin\/stunnel) vi \/etc\/init.d\/stunnel #!\/bin\/bash # # stunnel This shell script takes care of starting and stopping # stunnel # # chkconfig: 345 80 30 # description: Secure tunnel # processname: stunnel # [&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\/247"}],"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=247"}],"version-history":[{"count":0,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=\/wp\/v2\/posts\/247\/revisions"}],"wp:attachment":[{"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=247"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=247"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/blog.trungson.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=247"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}