diff options
Diffstat (limited to 'system/cntlm/rc.cntlm')
-rw-r--r-- | system/cntlm/rc.cntlm | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/system/cntlm/rc.cntlm b/system/cntlm/rc.cntlm new file mode 100644 index 000000000000..7aee0f70b5b1 --- /dev/null +++ b/system/cntlm/rc.cntlm @@ -0,0 +1,64 @@ +#!/bin/sh +# +# cntlm - NTLM Authentication Proxy + + +exec="/usr/sbin/cntlm" +prog=cntlm +pidfile="/var/run/cntlm.pid" + +start() { + echo -n $"Starting $prog... " + if [ -e $pidfile ];then + if ps `cat $pidfile`|grep -q $exec >/dev/null 2>&1 ; then + echo "already running!" + return 1 + else + rm $pidfile + fi + fi + $exec -f -c /etc/cntlm.conf -P $pidfile > /dev/null 2>&1 & pid=$! + retval=$? + if [ $retval -eq 0 ];then + echo "done." + echo $pid > $pidfile + fi + return $retval +} + +stop() { + echo -n $"Stopping $prog... " + if [ ! -e $pidfile ];then + ps -ef|grep -v grep|grep -q $exec && ( killall -9 $prog ; echo "done." ) || echo "already stopped!" + return 0 + fi + kill -9 `cat $pidfile` >/dev/null 2>&1 + if ps `cat $pidfile`|grep -q $exec >/dev/null 2>&1 ; then + echo "fail!" + return 1 + else + rm $pidfile + echo "done." + return 0 + fi +} + +restart() { + stop + start +} + + +case "$1" in + start) + $1 + ;; + stop) + $1 + ;; + restart) + $1 + ;; + *) + echo $"Usage: $0 {start|stop|restart}";; +esac
\ No newline at end of file |