-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathxvp.rc
185 lines (159 loc) · 2.61 KB
/
xvp.rc
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
#!/bin/bash
#
# xvp Start, stop and manage xvp.
#
# chkconfig: 2345 90 10
# description: Starts and stops VNC Console Proxy Server for XenServer
# processname: xvp
# config: /etc/xvp.conf
# pidfile:/var/run/xvp.pid
### BEGIN INIT INFO
# Provides: xvp
# Required-Start: $syslog $network
# Required-Stop: $syslog $network
# Default-Start:
# Default-Stop: 0 1 2 3 4 5 6
# Short-Description: start and stop xvp
# Description: xvp is a VNC Console Proxy Server for XenServer
### END INIT INFO
RETVAL=0
prog="xvp"
XVP=/usr/sbin/xvp
# set sysconfig settings
[ -f /etc/sysconfig/xvp ] && . /etc/sysconfig/xvp
if [ -f /etc/init.d/functions ]; then
#
# Red Hat style distro
# --------------------
#
. /etc/init.d/functions
LOCK_FILE=/var/lock/subsys/xvp
RETVAL=0
start() {
echo -n $"Starting $prog: "
daemon $prog $XVPARGS
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch $LOCK_FILE
return $RETVAL
}
stop() {
echo -n $"Stopping $prog: "
killproc $XVP
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && rm -f $LOCK_FILE
return $RETVAL
}
reload() {
echo -n $"Reloading $prog: "
killproc $XVP -HUP && killproc $XVP -USR1
RETVAL=$?
echo
return $RETVAL
}
dump() {
echo -n $"Dumping $prog: "
killproc $XVP -USR2
RETVAL=$?
echo
return $RETVAL
}
disconnect() {
echo -n $"Disconnecting $prog: "
killproc $XVP -QUIT
RETVAL=$?
echo
return $RETVAL
}
condrestart() {
if [ -f $LOCK_FILE ]; then
stop
sleep 3
start
fi
}
showstatus() {
status $XVP
RETVAL=$?
return $RETVAL
}
elif [ -f /etc/rc.status ]; then
#
# SuSE style distro
# -----------------
#
XVP_PIDFILE=/var/run/xvp.pid
. /etc/rc.status
rc_reset
start() {
echo -n $"Starting $prog"
startproc $XVP $XVPARGS
rc_status -v
}
stop() {
echo -n $"Stopping $prog"
killproc -p $XVP_PIDFILE -TERM $XVP
rc_status -v
}
reload() {
echo -n $"Reloading $prog"
killproc -p $XVP_PIDFILE -HUP $XVP
killproc -p $XVP_PIDFILE -USR1 $XVP
rc_status -v
}
dump() {
echo -n $"Reloading $prog"
killproc -p $XVP_PIDFILE -USR2 $XVP
rc_status -v
}
disconnect() {
echo -n $"Disconnecting $prog"
killproc -p $XVP_PIDFILE -QUIT $XVP
rc_status -v
}
condrestart() {
if checkproc -p $XVP_PIDFILE $XVP; then
stop
sleep 3
start
fi
}
showstatus() {
echo -n "Checking for ${prog}: "
checkproc -p $XVP_PIDFILE $XVP
rc_status -v
}
fi
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 3
start
;;
reload)
reload
;;
dump)
dump
;;
disconnect)
disconnect
;;
status)
showstatus
;;
condrestart)
condrestart
;;
*)
echo $"Usage: $0 {start|stop|status|reload|dump|disconnect|restart|condrestart}"
RETVAL=3
esac
exit $RETVAL