diff options
| author | David Sommerseth <davids@redhat.com> | 2010-03-19 20:52:47 +0100 |
|---|---|---|
| committer | David Sommerseth <davids@redhat.com> | 2010-03-19 20:52:47 +0100 |
| commit | bfdd4812d655963712bda0e933ce067bf3598b0d (patch) | |
| tree | 0057190a56d080b6cb3651a958b0edf0262b171b /server/parser | |
| parent | 95dbe491c32118fae2fc3db701b57f38654fe5a3 (diff) | |
| download | rteval-bfdd4812d655963712bda0e933ce067bf3598b0d.tar.gz rteval-bfdd4812d655963712bda0e933ce067bf3598b0d.tar.xz rteval-bfdd4812d655963712bda0e933ce067bf3598b0d.zip | |
Added initial init.d script and sysconfig file for rteval_parserd
Diffstat (limited to 'server/parser')
| -rwxr-xr-x | server/parser/rteval_parserd.init | 122 | ||||
| -rw-r--r-- | server/parser/rteval_parserd.sysconfig | 23 |
2 files changed, 145 insertions, 0 deletions
diff --git a/server/parser/rteval_parserd.init b/server/parser/rteval_parserd.init new file mode 100755 index 0000000..960f3d4 --- /dev/null +++ b/server/parser/rteval_parserd.init @@ -0,0 +1,122 @@ +#!/bin/bash +# +# rteval_parserd rteval parser daemon +# +# Author: David Sommerseth <davids@redhat.com> +# +# Copyright 2009 Red Hat, Inc. and/or its affiliates. +# Released under the GPL +# +# chkconfig: 345 84 16 +# description: The rteval_parserd waits for rteval summary reports and parses them on arrival +# config: /etc/sysconfig/rteval_parserd +# +### BEGIN INIT INFO +# Provides: rteval_parserd +# Required-Start: postgresql +# Required-Stop: +# Should-Start: +# Default-Start: 3 4 5 +# Short-Description: start and stop rteval_parserd +# Description: The rteval_parserd waits for rteval summary reports and parses them on arrival +### END INIT INFO + +. /etc/rc.d/init.d/functions + +if [ -f /etc/sysconfig/rteval_parserd ]; then + . /etc/sysconfig/rteval_parserd +fi + +prog=rteval_parserd +RETVAL=0 + +if [ -z $PIDFILE ]; then + PIDFILE=/var/run/$prog.pid +fi + +start() { + # Check if we have a pid file, if we do check that it is correct + if [ -f $PIDFILE ]; then + filepid=$(cat $PIDFILE) + chkpid=$(pidof $prog) + if [ $? = 0 ]; then + if [ "$chkpid" != "$filepid" ] ; then + # We have a pid file which is not correct, fix it + echo $chkpid > $PIDFILE + filepid=$chkpid + fi + echo "$prog is already started (pid $filepid)" + return 0 + else + # No process really exists, clean up! + rm -f $PIDFILE + fi + fi + + # Start a new daemon + args="--daemon" + if [ -z "$NUM_THREADS" ]; then + # If NUM_THREADS is not set, use number of cores found. + NUM_THREADS=$(find /sys/devices/system/cpu/cpu? -maxdepth 0 -type d | wc -l) + fi + args="$args --threads $NUM_THREADS" + + if [ ! -z "$LOG" ]; then + args="$args --log $LOG" + fi + + if [ ! -z "$LOGLEVEL" ]; then + args="$args --log-level $LOGLEVEL" + fi + + if [ ! -z "$CONFIGFILE" ]; then + args="$args --config $CONFIGFILE" + fi + echo -n $"Starting $prog ($NUM_THREADS threads): " + $prog $args + pidof $prog > $PIDFILE + RETVAL=$? + [ $RETVAL = 0 ] && success $"$prog startup" || failure $"$prog startup" + echo + return $RETVAL +} + +stop() { + echo -n $"Stopping $prog: " + if [ ! -f $PIDFILE ]; then + chkpid=$(pidof $prog) + if [ $? = 0 ]; then + PID=$chkpid + fi + else + PID=$(cat $PIDFILE) + fi + kill -TERM $PID + RETVAL=$? + [ $RETVAL = 0 ] && success $"$prog shutdown" || failure $"$prog (pid $PID) shutdown" + echo + rm -f $PIDFILE +} + +case "$1" in + start) + start + ;; + stop) + stop + ;; + status) + status $prog + ;; + restart) + stop + start + ;; + condrestart) + ;; + *) + echo $"Usage: $prog {start|stop|restart|status|help}" + RETVAL=3 +esac + +exit $RETVAL diff --git a/server/parser/rteval_parserd.sysconfig b/server/parser/rteval_parserd.sysconfig new file mode 100644 index 0000000..c181c44 --- /dev/null +++ b/server/parser/rteval_parserd.sysconfig @@ -0,0 +1,23 @@ +# Configuration parameters for rteval_parserd + +# *** Number of worker threads +# * When this is not set, the default will be one thread per CPU core +# NUM_THREADS=2 + +# *** Logging +# * Valid values: syslog:[facility] or a file name (full path) +# * Valid facility values: daemon, user and local0 to local7 +# * Default facility will be daemon +LOG=syslog: + +# *** Log level +# * Valid values: emerg, alert, crit, error, warn, notice, info, debug +LOGLEVEL=notice + +# *** rteval configuration file +# * Default value when not set is /etc/rteval.conf +# CONFIGFILE=/etc/rteval.conf + +# *** PID file +# * Full path to where to look for the PID file, defaults to /var/run/rteval_parserd.pid +# PIDFILE=/var/run/rteval_parserd.pid |
