{"id":3299,"date":"2014-07-06T10:58:59","date_gmt":"2014-07-06T02:58:59","guid":{"rendered":"http:\/\/rmohan.com\/?p=3299"},"modified":"2014-07-06T10:58:59","modified_gmt":"2014-07-06T02:58:59","slug":"apache-restart","status":"publish","type":"post","link":"https:\/\/mohan.sg\/?p=3299","title":{"rendered":"Apache restart"},"content":{"rendered":"<pre style=\"color: #000000; text-transform: none; line-height: normal; text-indent: 0px; letter-spacing: normal; font-style: normal; font-variant: normal; font-weight: normal; word-spacing: 0px; white-space: pre-wrap; -ms-word-wrap: break-word; -webkit-text-stroke-width: 0px;\">#!\/bin\/bash\r\n#\r\n# apache\tStart the apache HTTP server.\r\n#\r\n# The variables below are NOT to be changed.  They are there to make the\r\n# script more readable.\r\n\r\nNAME=apache\r\nDAEMON=\/usr\/sbin\/$NAME\r\nPIDFILE=\/var\/run\/$NAME.pid\r\nCONF=\/etc\/$NAME\/httpd.conf\r\nAPACHECTL=\/usr\/sbin\/${NAME}ctl\r\n# note: SSD is required only at startup of the daemon.\r\nSSD=`which start-stop-daemon`\r\nENV=\"env -i LANG=C PATH=\/bin:\/usr\/bin:\/usr\/local\/bin\"\r\n\r\nSHIB_HOME=\/opt\/shibboleth-1.3\r\nLD_LIBRARY_PATH=${SHIB_HOME}\/libexec:${SHIB_HOME}\/lib\r\nexport LD_LIBRARY_PATH\r\n\r\ntrap \"\" 1\r\n\r\n# Check that we're not being started by inetd\r\nif egrep -q -i \"^[[:space:]]*ServerType[[:space:]]+inet\" $CONF\r\nthen\r\n    exit 0\r\nfi\r\n\r\ntest_config() {\r\n    if [ ! -x $APACHECTL ]; then\r\n\techo \"$APACHECTL is not executable, exiting\"\r\n\texit 0\r\n    fi\r\n\r\n    # ensure we don't leak environment vars into apachectl\r\n    APACHECTL=\"$ENV $APACHECTL\"\r\n\r\n    if ! $APACHECTL configtest 2&gt; \/dev\/null\r\n    then\r\n        printf \"Configuration syntax error detected. Not reloading.\\n\\n\"\r\n        $APACHECTL configtest\r\n        exit 1\r\n    fi\r\n}\r\n\r\nshould_start() {\r\n    if [ ! -x $DAEMON ]; then\r\n\techo \"apache is not executable, not starting\"\r\n\texit 0\r\n    fi\r\n}\r\n\r\ncase \"$1\" in\r\n  start)\r\n    should_start\r\n    test_config\r\n    echo -n \"Starting web server: $NAME\"\r\n    $ENV $SSD --start --pidfile $PIDFILE --exec $DAEMON &gt; \/dev\/null\r\n    ;;\r\n\r\n  stop)\r\n    echo -n \"Stopping web server: $NAME\"\r\n    start-stop-daemon --stop --pidfile $PIDFILE --oknodo\r\n    rm -rf \/var\/lib\/apache\/mod-bandwidth\/link\/*\r\n    ;;\r\n\r\n  reload | force-reload)\r\n    test_config\r\n    echo -n \"Reloading $NAME configuration\"\r\n    start-stop-daemon --stop --pidfile $PIDFILE --signal USR1\r\n    ;;\r\n\r\n  reload-modules)\r\n    test_config\r\n    echo -n \"Reloading $NAME modules\"\r\n    start-stop-daemon --stop --pidfile $PIDFILE --oknodo --retry 30\r\n    should_start\r\n    $ENV $SSD --start --pidfile $PIDFILE --exec $DAEMON &gt; \/dev\/null\r\n    ;;\r\n\r\n  restart)\r\n    test_config\r\n    echo -n \"Restarting $NAME\"\r\n    if ! start-stop-daemon -q --stop --pidfile $PIDFILE --signal HUP; then\r\n\t$ENV $SSD --start --pidfile $PIDFILE --exec $DAEMON &gt; \/dev\/null\r\n    fi\r\n    ;;\r\n\r\n  *)\r\n    echo \"Usage: \/etc\/init.d\/$NAME {start|stop|reload|reload-modules|force-reload|restart}\"\r\n    exit 1\r\n    ;;\r\nesac\r\n\r\nif [ $? -eq 0 ]; then\r\n\techo .\r\n\texit 0\r\nelse\r\n\techo \" failed\"\r\n\texit 1\r\nfi<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>#!\/bin\/bash # # apache Start the apache HTTP server. # # The variables below are NOT to be changed. They are there to make the # script more readable. NAME=apache DAEMON=\/usr\/sbin\/$NAME PIDFILE=\/var\/run\/$NAME.pid CONF=\/etc\/$NAME\/httpd.conf APACHECTL=\/usr\/sbin\/${NAME}ctl # note: SSD is required only at startup of the daemon. SSD=`which start-stop-daemon` ENV=&#8221;env -i LANG=C PATH=\/bin:\/usr\/bin:\/usr\/local\/bin&#8221; SHIB_HOME=\/opt\/shibboleth-1.3 LD_LIBRARY_PATH=${SHIB_HOME}\/libexec:${SHIB_HOME}\/lib export LD_LIBRARY_PATH [&#8230;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[47],"tags":[],"_links":{"self":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3299"}],"collection":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3299"}],"version-history":[{"count":1,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3299\/revisions"}],"predecessor-version":[{"id":3300,"href":"https:\/\/mohan.sg\/index.php?rest_route=\/wp\/v2\/posts\/3299\/revisions\/3300"}],"wp:attachment":[{"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3299"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3299"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mohan.sg\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3299"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}