Matt Domsch 8ba2153
#!/bin/sh
Matt Domsch 8ba2153
#
Matt Domsch 8ba2153
# cntlmd: Start/stop the cntlm proxy.
Matt Domsch 8ba2153
#
Matt Domsch 8ba2153
# chkconfig:  - 26 89 
Matt Domsch 8ba2153
# description:       Cntlm is meant to be given your proxy address and becomming \
Matt Domsch 8ba2153
#                    the primary proxy then, listening on a selected local port.  \
Matt Domsch 8ba2153
#                    You point all your proxy-aware programs to it and don't ever \
Matt Domsch 8ba2153
#                    have to deal with proxy authentication again. \
Matt Domsch 8ba2153
Matt Domsch 8ba2153
Matt Domsch 8ba2153
### BEGIN INIT INFO
Matt Domsch 8ba2153
# Provides: cntlm
Matt Domsch 8ba2153
# Required-Start: $syslog $network $time
Matt Domsch 8ba2153
# Required-Stop:  $syslog $network $time
Matt Domsch 8ba2153
# Short-Description: Authenticating HTTP accelerator for NTLM secured proxies
Matt Domsch 8ba2153
# Description:       Cntlm is meant to be given your proxy address and becomming
Matt Domsch 8ba2153
#                    the primary proxy then, listening on a selected local port. 
Matt Domsch 8ba2153
#                    You point all your proxy-aware programs to it and don't ever
Matt Domsch 8ba2153
#                    have to deal with proxy authentication again.
Matt Domsch 8ba2153
### END INIT INFO
Matt Domsch 8ba2153
Matt Domsch 8ba2153
# Source function library.
Matt Domsch 8ba2153
. /etc/rc.d/init.d/functions
Matt Domsch 8ba2153
Matt Domsch 8ba2153
exec="/usr/sbin/cntlm"
Matt Domsch 8ba2153
prog="cntlmd"
Matt Domsch 8ba2153
config="/etc/cntlm.conf"
Matt Domsch 8ba2153
Matt Domsch 8ba2153
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
Matt Domsch 8ba2153
Matt Domsch 8ba2153
lockfile=/var/lock/subsys/$prog
Matt Domsch 8ba2153
Matt Domsch 8ba2153
start() {
Matt Domsch 8ba2153
    [ -x $exec ] || exit 5
Matt Domsch 8ba2153
    [ -f $config ] || exit 6
Matt Domsch 8ba2153
    echo -n $"Starting $prog: "
Matt Domsch 8ba2153
    daemon $exec -c $config $OPTARGS
Matt Domsch 8ba2153
    retval=$?
Matt Domsch 8ba2153
    echo
Matt Domsch 8ba2153
    [ $retval -eq 0 ] && touch $lockfile
Matt Domsch 8ba2153
    return $retval
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
stop() {
Matt Domsch 8ba2153
    echo -n $"Stopping $prog: "
Matt Domsch 8ba2153
    killproc -p $PIDFILE $prog
Matt Domsch 8ba2153
    retval=$?
Matt Domsch 8ba2153
    echo
Matt Domsch 8ba2153
    [ $retval -eq 0 ] && rm -f $lockfile
Matt Domsch 8ba2153
    return $retval
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
restart() {
Matt Domsch 8ba2153
    stop
Matt Domsch 8ba2153
    start
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
reload() {
Matt Domsch 8ba2153
    restart
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
force_reload() {
Matt Domsch 8ba2153
    restart
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
rh_status() {
Matt Domsch 8ba2153
    # run checks to determine if the service is running or use generic
Matt Domsch 8ba2153
    status
Matt Domsch 8ba2153
    status -p $PIDFILE $prog
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
rh_status_q() {
Matt Domsch 8ba2153
    rh_status >/dev/null 2>&1
Matt Domsch 8ba2153
}
Matt Domsch 8ba2153
Matt Domsch 8ba2153
Matt Domsch 8ba2153
case "$1" in
Matt Domsch 8ba2153
    start)
Matt Domsch 8ba2153
        rh_status_q && exit 0
Matt Domsch 8ba2153
        $1
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    stop)
Matt Domsch 8ba2153
        rh_status_q || exit 0
Matt Domsch 8ba2153
        $1
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    restart)
Matt Domsch 8ba2153
        $1
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    reload)
Matt Domsch 8ba2153
        rh_status_q || exit 7
Matt Domsch 8ba2153
        $1
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    force-reload)
Matt Domsch 8ba2153
        force_reload
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    status)
Matt Domsch 8ba2153
        rh_status
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    condrestart|try-restart)
Matt Domsch 8ba2153
        rh_status_q || exit 0
Matt Domsch 8ba2153
        restart
Matt Domsch 8ba2153
        ;;
Matt Domsch 8ba2153
    *)
Matt Domsch 8ba2153
        echo $"Usage: $0
Matt Domsch 8ba2153
    {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
Matt Domsch 8ba2153
        exit 2
Matt Domsch 8ba2153
esac
Matt Domsch 8ba2153
exit $?