mirror of
https://github.com/Ponce/slackbuilds
synced 2024-11-14 21:56:41 +01:00
8ed78fdce5
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
64 lines
No EOL
1.2 KiB
Bash
64 lines
No EOL
1.2 KiB
Bash
#!/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 |