#!/sbin/runscript # Taahir Ahmed # OpenRC init script for scm-manager. It's installed in scm-user's home # directory, and we drop root priveleges before we invoke it. It's a java # webapp, so my trust in it isn't particularly high. depend() { # Doesn't make sense to run without network access. At the very least, we # need a loopback. need net # I'm pretty sure it can talk to syslog. use logger } JAVA_HOME=$(java-config --jre-home) BASEDIR=/home/scm-user/scm-server REPO="$BASEDIR"/lib CLASSPATH=${CLASSPATH}:"$BASEDIR"/conf CLASSPATH=${CLASSPATH}:"$REPO"/scm-server-1.32.jar CLASSPATH=${CLASSPATH}:"$REPO"/commons-daemon-1.0.10.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-server-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/javax.servlet-2.5.0.v201103041518.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-continuation-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-http-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-io-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-webapp-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-xml-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-servlet-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-security-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-jmx-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-util-7.6.11.v20130520.jar CLASSPATH=${CLASSPATH}:"$REPO"/jetty-ajp-7.6.11.v20130520.jar start() { # if [ "${RC_CMD}" = "restart" ]; # then # # I don't think a restart requires anything special # fi ebegin "Starting scm-manager" # Launch the daemon using jsvc (from the dev-java/commons-daemon package). /usr/bin/jsvc \ -java-home $JAVA_HOME \ -cp "$CLASSPATH" \ -Djava.awt.headless=true \ -Dlogback.configurationFile=logging.xml \ -user scm-user \ -outfile "$BASEDIR/var/log/scm-server.out" \ -errfile "$BASEDIR/var/log/scm-server.err" \ -pidfile "$BASEDIR/var/scm-server.pid" \ -Dapp.name="scm-server" \ -Dapp.repo="$REPO" \ -Dbasedir="$BASEDIR" \ sonia.scm.server.ScmServerDaemon eend $? } stop() { ebegin "Stopping scm-manager" # Stop using jsvc and the pidfile created during "start". /usr/bin/jsvc \ -verbose \ -stop \ -java-home $JAVA_HOME \ -cp "$CLASSPATH" \ -user scm-user \ -outfile "$BASEDIR/var/log/scm-server.out" \ -errfile "$BASEDIR/var/log/scm-server.err" \ -pidfile "$BASEDIR/var/scm-server.pid" \ -Dapp.name="scm-server" \ -Dapp.repo="$REPO" \ -Dbasedir="$BASEDIR" \ -Djava.awt.headless=true \ -Dlogback.configurationFile=logging.xml \ sonia.scm.server.ScmServerDaemon eend $? }