1 |
#!/bin/bash |
2 |
# imspector This shell script takes care of starting and stopping |
3 |
# Imspector IM proxy |
4 |
# |
5 |
# chkconfig: 345 90 25 |
6 |
# description: Imspector - IMSpector is an Instant Messenger proxy with \ |
7 |
# monitoring, blocking and content-filtering capabilities. Currently \ |
8 |
# it supports MSN, Jabber/XMPP, AIM,ICQ, Yahoo, IRC and Gadu-Gadu to \ |
9 |
# different degrees |
10 |
# pidfile: /var/run/imspector/imspector.pid |
11 |
# config: /etc/imspector/imspector.conf |
12 |
|
13 |
### BEGIN INIT INFO |
14 |
# Provides: imspector |
15 |
# Required-Start: $network |
16 |
# Required-Stop: $network |
17 |
# Should-Start: $named |
18 |
# Should-Stop: $named |
19 |
# Short-Description: Starts the squid daemon |
20 |
# Description: Imspector is a full-featured MI proxy with support for \ |
21 |
# many protocols, as MSN, ICQ and others. |
22 |
# |
23 |
### END INIT INFO |
24 |
|
25 |
|
26 |
PATH=/usr/bin:/sbin:/bin:/usr/sbin |
27 |
export PATH |
28 |
|
29 |
# Source function library. |
30 |
. /etc/rc.d/init.d/functions |
31 |
|
32 |
# Source networking configuration. |
33 |
. /etc/sysconfig/network |
34 |
|
35 |
# Check that networking is up. |
36 |
[ ${NETWORKING} = "no" ] && exit 0 |
37 |
|
38 |
if [ -f /etc/sysconfig/imspector ]; then |
39 |
. /etc/sysconfig/imspector |
40 |
fi |
41 |
|
42 |
# check if the imspector conf file is present |
43 |
[ -f $IMSPECTOR_CONFIG ] || exit 0 |
44 |
|
45 |
|
46 |
# don't raise an error if the config file is incomplete |
47 |
# set defaults instead: |
48 |
IMSPECTOR_OPTS=${IMSPECTOR_OPTS:-""} |
49 |
|
50 |
IMSPECTOR=imspector |
51 |
prog=$IMSPECTOR |
52 |
|
53 |
RETVAL=0 |
54 |
|
55 |
start() { |
56 |
|
57 |
echo -n $"Starting $prog: " |
58 |
$IMSPECTOR $IMSPECTOR_OPTS >> /var/log/imspector/imspector.out 2>&1 |
59 |
RETVAL=$? |
60 |
if [ $RETVAL -eq 0 ]; then |
61 |
pidof $IMSPECTOR > /var/run/imspector.pid |
62 |
fi |
63 |
|
64 |
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$IMSPECTOR |
65 |
[ $RETVAL -eq 0 ] && success |
66 |
[ $RETVAL -ne 0 ] && failure |
67 |
echo |
68 |
return $RETVAL |
69 |
} |
70 |
|
71 |
stop() { |
72 |
echo -n $"Stopping $prog: " |
73 |
RETVAL=$? |
74 |
if [ $RETVAL -eq 0 ] ; then |
75 |
[ -f //var/run/imspector.pid ] && kill `cat /var/run/imspector.pid` 2>&1 |
76 |
rm -f /var/lock/subsys/$IMSPECTOR /var/run/imspector.pid |
77 |
success; echo |
78 |
else |
79 |
failure; echo |
80 |
fi |
81 |
return $RETVAL |
82 |
} |
83 |
|
84 |
reload() { |
85 |
echo "not implemented yet" |
86 |
} |
87 |
|
88 |
restart() { |
89 |
stop |
90 |
start |
91 |
} |
92 |
|
93 |
condrestart() { |
94 |
[ -e /var/lock/subsys/imspector ] && restart || : |
95 |
} |
96 |
|
97 |
rhstatus() { |
98 |
echo "not implemented yet" |
99 |
} |
100 |
|
101 |
probe() { |
102 |
return 0 |
103 |
} |
104 |
|
105 |
case "$1" in |
106 |
start) |
107 |
start |
108 |
;; |
109 |
|
110 |
stop) |
111 |
stop |
112 |
;; |
113 |
|
114 |
reload) |
115 |
reload |
116 |
;; |
117 |
|
118 |
restart) |
119 |
restart |
120 |
;; |
121 |
|
122 |
condrestart) |
123 |
condrestart |
124 |
;; |
125 |
|
126 |
status) |
127 |
rhstatus |
128 |
;; |
129 |
|
130 |
probe) |
131 |
exit 0 |
132 |
;; |
133 |
|
134 |
*) |
135 |
echo $"Usage: $0 {start|stop|status|reload|restart|condrestart}" |
136 |
exit 1 |
137 |
esac |
138 |
|
139 |
exit $? |