Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/sh
2
#
3
# spice-vdagentd Agent daemon for Spice guests
4
#
5
# chkconfig:   345 70 30
6
# description: Together with a per X-session agent process the spice agent \
7
#              daemon enhances the spice guest user experience with client \
8
#              mouse mode, guest <-> client copy and paste support and more.
9
 
10
### BEGIN INIT INFO
11
# Provides: spice-vdagentd
12
# Required-Start: $local_fs messagebus
13
# Required-Stop: $local_fs messagebus
14
# Should-Start: $local_fs messagebus
15
# Should-Stop: $local_fs messagebus
16
# Default-Start: 5
17
# Default-Stop: 0 1 2 3 4 6
18
# Short-Description: Agent daemon for Spice guests
19
# Description: Together with a per X-session agent process the spice agent
20
#	daemon enhances the spice guest user experience with client
21
#	mouse mode, guest <-> client copy and paste support and more.
22
### END INIT INFO
23
 
24
# Source function library.
25
. /etc/rc.d/init.d/functions
26
 
27
exec="/usr/sbin/spice-vdagentd"
28
prog="spice-vdagentd"
29
port="/dev/virtio-ports/com.redhat.spice.0"
30
pid="/var/run/spice-vdagentd/spice-vdagentd.pid"
31
 
32
[ -e /etc/sysconfig/$prog ] && . /etc/sysconfig/$prog
33
 
34
lockfile=/var/lock/subsys/$prog
35
 
36
start() {
37
    [ -x $exec ] || exit 5
38
    [ -c $port ] || exit 0
39
    modprobe uinput > /dev/null 2>&1
40
    # In case the previous running vdagentd crashed
41
    rm -f /var/run/spice-vdagentd/spice-vdagent-sock
42
    echo -n $"Starting $prog: "
43
    daemon --pidfile $pid $exec $SPICE_VDAGENTD_EXTRA_ARGS
44
    retval=$?
45
    echo
46
    [ $retval -eq 0 ] && touch $lockfile
47
    return $retval
48
}
49
 
50
stop() {
51
    echo -n $"Stopping $prog: "
52
    killproc -p $pid $prog
53
    retval=$?
54
    echo
55
    [ $retval -eq 0 ] && rm -f $lockfile
56
    return $retval
57
}
58
 
59
restart() {
60
    stop
61
    start
62
}
63
 
64
reload() {
65
    restart
66
}
67
 
68
force_reload() {
69
    restart
70
}
71
 
72
rh_status() {
73
    # run checks to determine if the service is running or use generic status
74
    status -p $pid $prog
75
}
76
 
77
rh_status_q() {
78
    rh_status >/dev/null 2>&1
79
}
80
 
81
 
82
case "$1" in
83
    start)
84
        rh_status_q && exit 0
85
        $1
86
        ;;
87
    stop)
88
        rh_status_q || exit 0
89
        $1
90
        ;;
91
    restart)
92
        $1
93
        ;;
94
    reload)
95
        rh_status_q || exit 7
96
        $1
97
        ;;
98
    force-reload)
99
        force_reload
100
        ;;
101
    status)
102
        rh_status
103
        ;;
104
    condrestart|try-restart)
105
        rh_status_q || exit 0
106
        restart
107
        ;;
108
    *)
109
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
110
        exit 2
111
esac
112
exit $?