blob: 9d504624d9f004445ffdee7b2479e507e5055838 (
plain) (
blame)
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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
|
#!/bin/sh
# For Redhat or Wind River Linux systems
#
# chkconfig: 345 29 71
# processname: /usr/sbin/tcf-agent
# description: Target Communication Framework
# For openSUSE system
#
### BEGIN INIT INFO
# Provides: tcf-agent
# Required-Start: $syslog $remote_fs
# Required-Stop: $syslog $remote_fs
# Default-Start: 3 5
# Default-Stop: 0 1 2 6
# Short-Description: Target Communication Framework agent
# Description: Target Communication Framework agent
### END INIT INFO
#
# Location of the TCF daemon and the init directory
#
DAEMON_PATH=/usr/sbin/tcf-agent
DAEMON_NAME=`basename $DAEMON_PATH`
DAEMON_ARGS="-d -L- -l0 -s SSL:"
#
# Determine which kind of configuration we're using
#
system=unknown
if [ -f /etc/redhat-release -o -f /etc/fedora-release ]; then
system=redhat
fi
if [ -f /etc/wrs-release ]; then
system=wrlinux
fi
if [ -f /etc/SuSE-release ]; then
system=suse
fi
if [ $system = unknown ]; then
echo "$0: Unknown system, please port and contact tcf-dev@eclipse.org" 1>&2
exit 1
fi
if [ $system = redhat ]; then
. /etc/init.d/functions
fi
if [ $system = wrlinux ]; then
. /etc/rc.d/init.d/functions
DAEMON_PATH=/usr/bin/tcf-agent
DAEMON_ARGS="-d -L- -l0"
fi
if [ $system = suse ]; then
. /etc/rc.status
rc_reset
fi
test -e $DAEMON_PATH || exit 0
PATH=/sbin:/usr/sbin:/bin:/usr/bin
export PATH
# Redhat start/stop function.
#
function redhat()
{
#
# See how we were called.
#
case "$1" in
start)
echo -n $"Starting $DAEMON_NAME:"
$DAEMON_PATH $DAEMON_ARGS
RETVAL=$?
if [ $RETVAL -eq 0 ] ; then
success "$DAEMON_NAME startup"
else
failure "$DAEMON_NAME startup"
fi
[ $RETVAL = 0 ] && touch /var/lock/subsys/$DAEMON_NAME
echo
;;
stop)
echo -n $"Stopping $DAEMON_NAME:"
count=0
while [ -n "`/sbin/pidof $DAEMON_PATH`" -a $count -lt 10 ] ; do
killproc $DAEMON_PATH -USR2 >& /dev/null
sleep 1
RETVAL=$?
if [ $RETVAL != 0 -o -n "`/sbin/pidof $DAEMON_PATH`" ] ; then
sleep 3
fi
count=`expr $count + 1`
done
rm -f /var/lock/subsys/$DAEMON_NAME
if [ -n "`/sbin/pidof $DAEMON_PATH`" ] ; then
failure "$DAEMON_NAME shutdown"
else
success "$DAEMON_NAME shutdown"
fi
echo
;;
restart)
redhat stop
redhat start
;;
status)
if [ -n "`/sbin/pidof $DAEMON_PATH`" ] ; then
echo "$DAEMON_NAME is running"
else
echo "$DAEMON_NAME is not running"
fi
;;
condrestart)
[ -f /var/lock/subsys/$DAEMON_NAME ] && redhat restart
;;
*)
echo $"Usage: $0 {start|stop|restart|condrestart|status}"
esac
}
# SuSE start/stop function.
#
function suse()
{
#
# See how we were called.
#
case "$1" in
start)
echo -n "Starting TCF agent "
/sbin/startproc -l /var/log/rctcfagent.log $DAEMON_PATH $DAEMON_ARGS
rc_status -v
;;
stop)
echo -n "Shutting down TCF agent "
/sbin/killproc -TERM $DAEMON_PATH
rc_status -v
;;
try-restart|condrestart)
## Do a restart only if the service was active before.
## Note: try-restart is now part of LSB (as of 1.9).
## RH has a similar command named condrestart.
if test "$1" = "condrestart"; then
echo "${attn} Use try-restart ${done}(LSB)${attn} rather than condrestart ${warn}(RH)${norm}"
fi
suse status
if test $? = 0; then
suse restart
else
rc_reset # Not running is not a failure.
fi
rc_status
;;
restart)
suse stop
suse start
rc_status
;;
force-reload)
echo -n "Reload service TCF agent "
/sbin/killproc -HUP $DAEMON_PATH
rc_status -v
;;
reload)
echo -n "Reload service TCF agent "
/sbin/killproc -HUP $DAEMON_PATH
rc_status -v
;;
status)
echo -n "Checking for service TCF agent "
/sbin/checkproc $DAEMON_PATH
rc_status -v
;;
*)
echo "Usage: $0 {start|stop|status|try-restart|restart|force-reload|reload}"
exit 1
;;
esac
}
if [ $system = suse ]; then
suse "$@"
rc_exit
fi
RETVAL=0
if [ $system = redhat -o $system = wrlinux ]; then
redhat "$@"
fi
exit $RETVAL
|