#!/bin/sh # Balance # # chkconfig: 2345 90 10 # description: Balance # Source function library. . /etc/rc.d/init.d/functions NAME="balance" test -f /etc/sysconfig/balance || exit 0 . /etc/sysconfig/balance test "x$PORTS" != x || exit 0 start() { for port in $PORTS; do eval /usr/sbin/balance `echo $port | tr ',' ' '` done touch /var/lock/subsys/balance } stop() { for pid in `ps auxww | grep /usr/sbin/balance | awk '{print $2}'`; do kill $pid >/dev/null 2>&1 done rm -f /var/lock/subsys/balance } case "$1" in start) start ;; stop) stop ;; restart) stop start ;; *) gprintf "Usage: %s {start|stop|restart}\n" "$0" exit 1 esac