34838602 |
1 | #!/bin/sh |
2 | # |
3 | # gdm: Starts the VNC server |
4 | # |
5 | # Version: @(#) /etc/rc.d/init.d/x11vncd 0.1 |
6 | # |
7 | # chkconfig: 5 96 04 |
8 | # description: Starts and stops the VNC server |
9 | # |
10 | # config: /etc/sysconfig/x11vncd |
11 | |
12 | . /etc/rc.d/init.d/functions |
13 | |
14 | RETVAL=0 |
15 | # See how we were called. |
16 | case "$1" in |
17 | start) |
18 | # Check if the service is already running? |
19 | if [ ! -f /var/lock/subsys/x11vncd ]; then |
20 | msg_starting "VNC Server" |
21 | daemon --fork /usr/sbin/x11vncd |
22 | RETVAL=$? |
23 | [ $RETVAL -eq 0 ] && touch /var/lock/subsys/x11vncd |
24 | else |
25 | msg_already_running "VNC Server" |
26 | fi |
27 | ;; |
28 | stop) |
29 | if [ -f /var/lock/subsys/x11vncd ]; then |
30 | msg_stopping "VNC Server" |
31 | killproc x11vncd |
32 | msg_stopping "x11vnc process" |
33 | killproc x11vnc |
34 | rm -f /var/lock/subsys/x11vncd |
35 | else |
36 | msg_not_running "VNC Server" |
37 | fi |
38 | ;; |
39 | status) |
40 | status x11vncd |
41 | status x11vnc |
42 | exit $? |
43 | ;; |
44 | restart|force-reload) |
45 | $0 stop |
46 | $0 start |
47 | exit $? |
48 | ;; |
49 | *) |
50 | msg_usage "$0 {start|stop|restart|force-reload|status}" |
51 | exit 3 |
52 | esac |
53 | |
54 | exit $RETVAL |