Blame | Last modification | View Log | RSS feed
#!/bin/bash## chkconfig: - 55 45# description: zabbix_agentd# probe: false# Source function library.. /etc/rc.d/init.d/functions# Source networking configuration.. /etc/sysconfig/network# Check that networking is up. If you are running without a network, comment this out.[ "${NETWORKING}" = "no" ] && exit 0RETVAL=0progdir="/usr/local/sbin/"prog="zabbix_agentd"start() {# Start daemons.if [ -n "`/sbin/pidof $prog`" ]; thenecho -n "$prog: already running"failure $"$prog start"echoreturn 1fiecho -n $"Starting $prog: "# we can't seem to use daemon here - emulate its functionalitysu -c $progdir$prog - $USERRETVAL=$?usleep 100000if [ -z "`/sbin/pidof $progdir$prog`" ]; then# The child processes have died after fork()ing, e.g.# because of a broken config fileRETVAL=1fi[ $RETVAL -ne 0 ] && failure $"$prog startup"[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$prog && success $"$prog startup"echoreturn $RETVAL}stop() {RETVAL=0pid=# Stop daemons.echo -n $"Stopping $prog: "pid=`/sbin/pidof -s $prog`rm /var/tmp/zabbix_agentd.pidif [ -n "$pid" ]; thenkill -TERM $pidelsefailure $"$prog stop"echoreturn 1fiRETVAL=$?[ $RETVAL -ne 0 ] && failure $"$prog stop"[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/$prog && success $"$prog stop"echoreturn $RETVAL}restart() {stop# wait for forked daemons to dieusleep 1000000start}# See how we were called.case "$1" instart)start;;stop)stop;;restart)restart;;condrestart)[ -f /var/lock/subsys/$prog ] && restart;;*)echo $"Usage: $0 {start|stop|restart|condrestart}"exit 1esacexit $?