Blame SOURCES/lldpd-el6.init

2b63ac
#!/bin/bash
2b63ac
# lldpd init file
2b63ac
#
2b63ac
# chkconfig: - 60 20
2b63ac
# description: 802.1ab (LLDP) daemon
2b63ac
#
2b63ac
# processname: lldpd
2b63ac
# pidfile: /var/run/lldpd.pid
2b63ac
2b63ac
### BEGIN INIT INFO
2b63ac
# Provides: lldpd
2b63ac
# Required-Start: $local_fs $remote_fs
2b63ac
# Required-Stop: $local_fs $remote_fs
2b63ac
# Should-Start: $syslog $network $net-snmp
2b63ac
# Should-Stop: $syslog $network $net-snmp
2b63ac
# Default-Stop: 0 1 6
2b63ac
# Short-Description: LLDP daemon
2b63ac
# Description: 802.1ab (LLDP) daemon
2b63ac
### END INIT INFO
2b63ac
2b63ac
# source function library
2b63ac
. /etc/rc.d/init.d/functions
2b63ac
2b63ac
exec="/usr/sbin/lldpd"
2b63ac
prog="lldpd"
2b63ac
config="/etc/lldpd.d"
2b63ac
2b63ac
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
2b63ac
2b63ac
lockfile=/var/lock/subsys/$prog
2b63ac
2b63ac
start() {
2b63ac
    [ -x $exec ] || exit 4
2b63ac
    [ -d $config ] || exit 6
2b63ac
    echo -n $"Starting $prog: "
2b63ac
    daemon $exec $LLDPD_OPTIONS
2b63ac
    retval=$?
2b63ac
    echo
2b63ac
    [ $retval -eq 0 ] && touch $lockfile
2b63ac
    return $retval
2b63ac
}
2b63ac
2b63ac
stop() {
2b63ac
    echo -n $"Stopping $prog: "
2b63ac
    killproc $exec
2b63ac
    retval=$?
2b63ac
    echo
2b63ac
    [ $retval -eq 0 ] && rm -f $lockfile
2b63ac
    return $RETVAL
2b63ac
}
2b63ac
2b63ac
restart() {
2b63ac
    stop
2b63ac
    start
2b63ac
}
2b63ac
2b63ac
reload() {
2b63ac
    restart
2b63ac
}
2b63ac
2b63ac
force_reload() {
2b63ac
    restart
2b63ac
}
2b63ac
2b63ac
rh_status() {
2b63ac
    # run checks to determine if the service is running or use generic status
2b63ac
    status $prog
2b63ac
}
2b63ac
2b63ac
rh_status_q() {
2b63ac
    rh_status >/dev/null 2>&1
2b63ac
}
2b63ac
2b63ac
case "$1" in
2b63ac
    start)
2b63ac
        rh_status_q && exit 0
2b63ac
        $1
2b63ac
        ;;
2b63ac
    stop)
2b63ac
        rh_status_q || exit 0
2b63ac
        $1
2b63ac
        ;;
2b63ac
    restart)
2b63ac
        $1
2b63ac
        ;;
2b63ac
    reload)
2b63ac
        rh_status_q || exit 7
2b63ac
        $1
2b63ac
        ;;
2b63ac
    force-reload)
2b63ac
        force_reload
2b63ac
        ;;
2b63ac
    status)
2b63ac
        rh_status
2b63ac
        ;;
2b63ac
    condrestart|try-restart)
2b63ac
        rh_status_q || exit 0
2b63ac
        restart
2b63ac
        ;;
2b63ac
    *)
2b63ac
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
2b63ac
        exit 2
2b63ac
esac
2b63ac
exit $?