~upstart-devel/upstart/upstart-jobs

« back to all changes in this revision

Viewing changes to vivid/etc/init.d/spice-vdagent

  • Committer: Dimitri John Ledkov
  • Date: 2014-11-19 12:58:41 UTC
  • Revision ID: dimitri.j.ledkov@intel.com-20141119125841-98dr37roy8dvcv3b
auto update

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# spice-vdagent 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-vdagent
 
12
# Required-Start:       $local_fs $remote_fs
 
13
# Required-Stop:        $local_fs $remote_fs
 
14
# Should-Start:         dbus
 
15
# Should-Stop:          
 
16
# Default-Start:        2 3 4 5
 
17
# Default-Stop:         0 1 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
 
 
25
exec="/usr/sbin/spice-vdagentd"
 
26
prog="spice-vdagentd"
 
27
pidfile="/var/run/spice-vdagentd/spice-vdagentd.pid"
 
28
port="/dev/virtio-ports/com.redhat.spice.0"
 
29
 
 
30
[ -e /etc/default/$prog ] && . /etc/default/$prog
 
31
[ ! -d /var/run/spice-vdagentd ] && mkdir -p /var/run/spice-vdagentd
 
32
 
 
33
. /lib/lsb/init-functions
 
34
 
 
35
lockfile=/var/lock/$prog
 
36
 
 
37
start() {
 
38
    [ -x $exec ] || exit 5
 
39
    [ -c $port ] || exit 0
 
40
    modprobe uinput > /dev/null 2>&1
 
41
    # In case the previous running vdagentd crashed
 
42
    rm -f /var/run/spice-vdagentd/spice-vdagent-sock
 
43
    log_daemon_msg "Starting Agent daemon for Spice guests" "spice-vdagent"
 
44
    if start-stop-daemon --start --quiet --oknodo --pidfile $pidfile --exec $exec -- ; then
 
45
        log_end_msg 0
 
46
    else
 
47
        log_end_msg 1
 
48
    fi
 
49
}
 
50
 
 
51
stop() {
 
52
    log_daemon_msg "Stopping Agent daemon for Spice guests" "spice-vdagent"
 
53
    if start-stop-daemon --stop --quiet --oknodo --pidfile $pidfile; then
 
54
        log_end_msg 0
 
55
    else
 
56
        log_end_msg 1
 
57
    fi
 
58
}
 
59
 
 
60
restart() {
 
61
    stop
 
62
    start
 
63
}
 
64
 
 
65
reload() {
 
66
    restart
 
67
}
 
68
 
 
69
force_reload() {
 
70
    restart
 
71
}
 
72
 
 
73
status() {
 
74
    status_of_proc -p $pidfile $exec $prog && exit 0 || exit $?
 
75
}
 
76
 
 
77
case "$1" in
 
78
    start)
 
79
        $1
 
80
        ;;
 
81
    stop)
 
82
        $1
 
83
        ;;
 
84
    restart)
 
85
        $1
 
86
        ;;
 
87
    reload)
 
88
        $1
 
89
        ;;
 
90
    force-reload)
 
91
        force_reload
 
92
        ;;
 
93
    status)
 
94
        status
 
95
        ;;
 
96
    condrestart|try-restart)
 
97
        status || exit 0
 
98
        restart
 
99
        ;;
 
100
    *)
 
101
        echo $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|reload|force-reload}"
 
102
        exit 2
 
103
esac
 
104
exit $?