{"action":"closed","issue":{"url":"https://api.github.com/repos/lightbody/browsermob-proxy/issues/268","labels_url":"https://api.github.com/repos/lightbody/browsermob-proxy/issues/268/labels{/name}","comments_url":"https://api.github.com/repos/lightbody/browsermob-proxy/issues/268/comments","events_url":"https://api.github.com/repos/lightbody/browsermob-proxy/issues/268/events","html_url":"https://github.com/lightbody/browsermob-proxy/issues/268","id":91254355,"number":268,"title":"cannot run bmp as a service","user":{"login":"adamgoucher","id":94401,"avatar_url":"https://avatars.githubusercontent.com/u/94401?v=3","gravatar_id":"","url":"https://api.github.com/users/adamgoucher","html_url":"https://github.com/adamgoucher","followers_url":"https://api.github.com/users/adamgoucher/followers","following_url":"https://api.github.com/users/adamgoucher/following{/other_user}","gists_url":"https://api.github.com/users/adamgoucher/gists{/gist_id}","starred_url":"https://api.github.com/users/adamgoucher/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/adamgoucher/subscriptions","organizations_url":"https://api.github.com/users/adamgoucher/orgs","repos_url":"https://api.github.com/users/adamgoucher/repos","events_url":"https://api.github.com/users/adamgoucher/events{/privacy}","received_events_url":"https://api.github.com/users/adamgoucher/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-26T13:39:14Z","updated_at":"2015-07-08T02:11:27Z","closed_at":"2015-07-08T02:11:27Z","body":"I'm trying to setup BMP for a client that will run as a service but it appears that the default ConsoleHandler is blocking the startup (or something) as when I start it by hand it will still spew out onto the console at the default of INFO or if I bump it to WARNING it just sits there. Managed installs [in this case via Chef] just hang or timeout as a result.\r\n\r\nHere is the init script I am using.\r\n\r\n```bash\r\n#!/bin/sh\r\n\r\n### BEGIN INIT INFO\r\n# Provides:          browsermob-proxy\r\n# Required-Start:    $local_fs $remote_fs $network $time $named\r\n# Should-Start:      $time\r\n# Required-Stop:     $local_fs $remote_fs $network $time $named\r\n# Should-Stop:       $time\r\n# Default-Start:     3 5\r\n# Default-Stop:      0 1 2 6\r\n# Short-Description: Browsermob Proxy\r\n# Description:       Browsermob Proxy\r\n### END INIT INFO\r\n\r\nBROWSERMOB_PID_FILE=\"/var/run/browsermob.pid\"\r\n\r\nBROWSERMOB_USER=\"browsermob\"\r\n\r\n# Source function library.\r\n. /etc/init.d/functions\r\n\r\n# Search usable Java. We do this because various reports indicated\r\n# that /usr/bin/java may not always point to Java >= 1.6\r\n# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html\r\ncandidates=\"\r\n/etc/alternatives/java\r\n/usr/lib/jvm/java-1.6.0/bin/java\r\n/usr/lib/jvm/jre-1.6.0/bin/java\r\n/usr/lib/jvm/java-1.7.0/bin/java\r\n/usr/lib/jvm/jre-1.7.0/bin/java\r\n/usr/lib/jvm/java-1.8.0/bin/java\r\n/usr/lib/jvm/jre-1.8.0/bin/java\r\n/usr/bin/java\r\n\"\r\nfor candidate in $candidates\r\ndo\r\n  [ -x \"$BROWSERMOB_JAVA_CMD\" ] && break\r\n  BROWSERMOB_JAVA_CMD=\"$candidate\"\r\ndone\r\n\r\nCLASSPATH=\"/usr/local/browsermob-proxy/*\"\r\n\r\nJVM_OPTS=\"\"\r\n\r\nJAVA_CMD=\"$BROWSERMOB_JAVA_CMD $JVM_OPTS -cp \\\"$CLASSPATH\\\" -Dapp.name=browsermob-proxy net.lightbody.bmp.proxy.Main\"\r\n\r\nPARAMS=\"-port 9090\"\r\n\r\nRETVAL=0\r\n\r\ncase \"$1\" in\r\n    start)\r\n        cd /usr/local/browsermob-proxy\r\n        echo -n \"Starting the Browsermob Proxy \"\r\n        daemon --user \"$BROWSERMOB_USER\" --pidfile \"$BROWSERMOB_PID_FILE\" $JAVA_CMD $PARAMS > /dev/null\r\n        RETVAL=$?\r\n        if [ $RETVAL = 0 ]; then\r\n            success\r\n            echo > \"$BROWSERMOB_PID_FILE\"  # just in case we fail to find it\r\n            MY_SESSION_ID=`/bin/ps h -o sess -p $$`\r\n            # get PID\r\n            /bin/ps hww -u \"$BROWSERMOB_USER\" -o sess,ppid,pid,cmd | \\\r\n            while read sess ppid pid cmd; do\r\n                [ \"$ppid\" = 1 ] || continue\r\n                # this test doesn't work because Jenkins sets a new Session ID\r\n                # [ \"$sess\" = \"$MY_SESSION_ID\" ] || continue\r\n                echo \"$cmd\" | grep $BROWSERMOB_JAR > /dev/null\r\n                [ $? = 0 ] || continue\r\n                # found a PID\r\n                echo $pid > \"$BROWSERMOB_PID_FILE\"\r\n            done\r\n        else\r\n            failure\r\n        fi\r\n        echo\r\n        ;;\r\n    stop)\r\n        echo -n \"Shutting down the Browsermob Proxy \"\r\n        killproc browsermob-proxy\r\n        RETVAL=$?\r\n        echo\r\n        ;;\r\n    try-restart|condrestart)\r\n        if test \"$1\" = \"condrestart\"; then\r\n                echo \"${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}\"\r\n        fi\r\n        $0 status\r\n        if test $? = 0; then\r\n                $0 restart\r\n        else\r\n                : # Not running is not a failure.\r\n        fi\r\n        ;;\r\n    restart)\r\n        $0 stop\r\n        $0 start\r\n        ;;\r\n    force-reload)\r\n        echo -n \"Reload service Browsermob-proxy \"\r\n        $0 try-restart\r\n        ;;\r\n    reload)\r\n        $0 restart\r\n        ;;\r\n    status)\r\n        status browsermob-proxy\r\n        RETVAL=$?\r\n        ;;\r\n    *)\r\n        echo \"Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}\"\r\n        exit 1\r\n        ;;\r\nesac\r\nexit $RETVAL\r\n```"}}