Skip to content

Instantly share code, notes, and snippets.

@arsenio
Created April 19, 2011 17:36
Show Gist options
  • Save arsenio/928962 to your computer and use it in GitHub Desktop.
Save arsenio/928962 to your computer and use it in GitHub Desktop.
scribed startup script
#!/bin/bash
# Starts and stops scribed
# arsenio@gmail.com
#
# chkconfig: 2345 90 10
# description: Scribe daemon
desc="Scribed daemon"
LOGDIR=/var/log/scribe
PID_FILE=${LOGDIR}/scribed.pid
LOG_FILE=${LOGDIR}/scribed.log
SCRIBED=/usr/local/bin/scribed
# Source function library.
. /etc/rc.d/init.d/functions
start() {
$SCRIBED >> $LOG_FILE 2>&1 &
RETVAL=$?
PID=$!
echo $PID > $PID_FILE
action $"Starting scribed: " /bin/true
}
stop() {
if [ -f "$PID_FILE" ]; then
PID=`cat $PID_FILE`
if [ -n "$PID" ]; then
rm -f $PID_FILE
/bin/kill "$PID" >/dev/null 2>&1
RETVAL=$?
action $"Stopping scribed: " /bin/true
echo
else
action $"No process found for existing scribed process. Error" /bin/false
fi
else
action $"No PID file found for existing scribed process. Error" /bin/false
fi
}
restart() {
stop
start
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
*)
echo $"Usage: $0 {start|stop|restart}"
exit 1
esac
exit $RETVAL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment