~ubuntu-branches/ubuntu/raring/apparmor/raring

« back to all changes in this revision

Viewing changes to utils/rc.sd-event-dispatch.suse

  • Committer: Bazaar Package Importer
  • Author(s): Kees Cook
  • Date: 2007-03-23 16:42:01 UTC
  • Revision ID: james.westby@ubuntu.com-20070323164201-jkax6f0oku087b7l
Tags: upstream-2.0.1+510.dfsg
ImportĀ upstreamĀ versionĀ 2.0.1+510.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# /etc/init.d/sd-event-dispatch
 
4
#
 
5
#   and symbolic its link
 
6
#
 
7
# /usr/sbin/rcsd-event-dispatch
 
8
#
 
9
# chkconfig: 2345 01 99
 
10
# description: SubDomain event dispatcher
 
11
#
 
12
### BEGIN INIT INFO
 
13
# Provides: sd-event-dispatch
 
14
# Required-Start: subdomain
 
15
# Default-Start: 3 4 5
 
16
# Default-Stop: 0 1 2 6
 
17
# Description: Start the SubDomain event dispacher
 
18
### END INIT INFO
 
19
 
 
20
SD_EV_BIN=/usr/sbin/sd-event-dispatch.pl
 
21
test -x $SD_EV_BIN || exit 5
 
22
 
 
23
SD_EV_PIDFILE=/var/run/sd-event-dispatch.init.pid
 
24
 
 
25
. /etc/rc.status
 
26
 
 
27
# Shell functions sourced from /etc/rc.status:
 
28
#      rc_check         check and set local and overall rc status
 
29
#      rc_status        check and set local and overall rc status
 
30
#      rc_status -v     ditto but be verbose in local rc status
 
31
#      rc_status -v -r  ditto and clear the local rc status
 
32
#      rc_failed        set local and overall rc status to failed
 
33
#      rc_reset         clear local rc status (overall remains)
 
34
#      rc_exit          exit appropriate to overall rc status
 
35
 
 
36
# First reset status of this service
 
37
rc_reset
 
38
 
 
39
case "$1" in
 
40
    start)
 
41
        echo -n "Starting SubDomain Event daemon"
 
42
        ## Start daemon with startproc(8). If this fails
 
43
        ## the echo return value is set appropriate.
 
44
 
 
45
        startproc -f -p $SD_EV_PIDFILE $SD_EV_BIN -o "PidFile=$SD_EV_PIDFILE" 
 
46
 
 
47
        # Remember status and be verbose
 
48
        rc_status -v
 
49
        ;;
 
50
    stop)
 
51
        echo -n "Shutting down SubDomain Event daemon"
 
52
        ## Stop daemon with killproc(8) and if this fails
 
53
        ## set echo the echo return value.
 
54
 
 
55
        /sbin/killproc -p $SD_EV_PIDFILE -TERM $SD_EV_BIN
 
56
 
 
57
        # Remember status and be verbose
 
58
        rc_status -v
 
59
        ;;
 
60
    try-restart)
 
61
        ## Stop the service and if this succeeds (i.e. the 
 
62
        ## service was running before), start it again.
 
63
        $0 status >/dev/null &&  $0 restart
 
64
 
 
65
        # Remember status and be quiet
 
66
        rc_status
 
67
        ;;
 
68
    restart)
 
69
        ## Stop the service and regardless of whether it was
 
70
        ## running or not, start it again.
 
71
        $0 stop
 
72
        $0 start
 
73
 
 
74
        # Remember status and be quiet
 
75
        rc_status
 
76
        ;;
 
77
    status)
 
78
        echo -n "Checking for SubDomain Event daemon"
 
79
        ## Check status with checkproc(8), if process is running
 
80
        ## checkproc will return with exit status 0.
 
81
 
 
82
        # Status has a slightly different for the status command:
 
83
        # 0 - service running
 
84
        # 1 - service dead, but /var/run/  pid  file exists
 
85
        # 2 - service dead, but /var/lock/ lock file exists
 
86
        # 3 - service not running
 
87
 
 
88
        checkproc -p $SD_EV_PIDFILE $SD_EV_BIN
 
89
 
 
90
        rc_status -v
 
91
        ;;
 
92
    *)
 
93
        echo "Usage: $0 {start|stop|status|try-restart|restart}"
 
94
        exit 1
 
95
        ;;
 
96
esac
 
97
rc_exit