Skip to content

Instantly share code, notes, and snippets.

@solarmicrobe
Created August 18, 2017 19:27
Show Gist options
  • Save solarmicrobe/5f47aacb7cfbe12020241f5d393c0103 to your computer and use it in GitHub Desktop.
Save solarmicrobe/5f47aacb7cfbe12020241f5d393c0103 to your computer and use it in GitHub Desktop.
Marid shell init.d script for SuSE 11SP4
#!/bin/bash
### BEGIN INIT INFO
# Provides: marid
# Required-Start: $network $named $remote_fs $syslog
# Required-Stop: $network $named $remote_fs $syslog
# Should-Start:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: marid
# Description: marid
### END INIT INFO
# Source function library
. /lib/lsb/init-functions
. /etc/opsgenie/profile
prog="marid"
DAEMON="${JAVA_HOME:-/usr}/bin/java"
DAEMON_ARGS="${MARID_JVM} -cp ${MARID_CLASSPATH} com.ifountain.opsgenie.client.marid.Bootstrap"
marid="$DAEMON $DAEMON_ARGS"
PID_FILE=/var/run/${prog}.pid
servicelog=/var/log/opsgenie/marid/service.log
start() {
echo -n $"Starting $prog: "
startproc -u opsgenie -g opsgenie -p $PID_FILE -l $servicelog $marid
PID=$(ps -u opsgenie -o pid,command -ww | egrep "$DAEMON.*com\.ifountain\.opsgenie\.client\.marid\.Bootstrap" | awk '{print $1}')
echo $PID > $PID_FILE
rc_status -v
}
stop() {
echo -n $"Stopping $prog: "
killproc -p $PID_FILE $DAEMON""
rc_status -v
}
### NOT USED
reload() {
echo -n $"Reloading $prog: "
killproc -p $PID_FILE "$marid" -HUP
RETVAL=$?
echo
return $RETVAL
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
start
;;
condrestart)
if [ -f /var/run/$prog ]; then
stop
start
fi
;;
status)
PID=`pidofproc -p $PID_FILE $DAEMON $prod`
checkproc -k -p $PID_FILE $DAEMON $prog
rc_status -v
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
esac
rc_exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment