blob: 7aee0f70b5b1de2818e60c1783cc425a54dfa490 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
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
|