~ubuntu-branches/ubuntu/oneiric/mcollective/oneiric-proposed

« back to all changes in this revision

Viewing changes to mcollective.init

  • Committer: Bazaar Package Importer
  • Author(s): Marc Cluet, Marc Cluet, Chuck Short
  • Date: 2011-05-05 07:37:54 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20110505073754-klk1jkz8afi4fomx
Tags: 1.2.0-0ubuntu1
[Marc Cluet]
* Update to 1.2.0
* Build for Oneiric.

[Chuck Short]
* Drop ruby from mcollective, mcollective-middleware, mcollective-client
  since its a dependency of mcollective-common.
* Bump standards to 3.9.2.
* Fix up lintian warnings.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
1
#!/bin/sh
2
2
#
3
 
# mcollective   Application Server for STOMP based agents
4
 
#
5
 
# chkconfig: 345 24 76
6
 
#
7
 
# description: mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
8
 
#              much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
9
 
#              as a bonus.
 
3
# mcollective   Application Server for STOMP based agents
 
4
#
 
5
# chkconfig:    345 24 76
 
6
#
 
7
# description:  mcollective lets you build powerful Stomp compatible middleware clients in ruby without having to worry too
 
8
#               much about all the setup and management of a Stomp connection, it also provides stats, logging and so forth
 
9
#               as a bonus.
10
10
#
11
11
### BEGIN INIT INFO
12
12
# Provides:          mcollective
25
25
 
26
26
# Lockfile
27
27
if [ -d /var/lock/subsys ]; then
28
 
  # RedHat/CentOS/etc who use subsys
29
 
  lock="/var/lock/subsys/mcollective"
 
28
    # RedHat/CentOS/etc who use subsys
 
29
    lock="/var/lock/subsys/mcollective"
30
30
else
31
 
  # The rest of them
32
 
  lock="/var/lock/mcollective"
 
31
    # The rest of them
 
32
    lock="/var/lock/mcollective"
33
33
fi
34
34
 
35
35
 
40
40
. /lib/lsb/init-functions
41
41
 
42
42
# Check that binary exists
43
 
if ! [ -f  $mcollectived ]
 
43
if ! [ -f $mcollectived ]
44
44
then
45
 
  echo "mcollectived binary not found"
46
 
  exit 0
 
45
    echo "mcollectived binary not found"
 
46
    exit 0
47
47
fi
48
48
 
49
49
# See how we were called.
50
50
case "$1" in
51
 
  start)
52
 
        echo -n "Starting mcollective: "
53
 
 
54
 
        if [ -f ${lock} ]; then
55
 
            # we were not shut down correctly
56
 
            if [ -s ${pidfile} ]; then
57
 
                kill `cat ${pidfile}` >/dev/null 2>&1
58
 
            fi
59
 
            rm -f ${pidfile}
60
 
 
61
 
            rm -f ${lock}
62
 
            sleep 2
63
 
        fi
64
 
 
65
 
        rm -f ${pidfile}
66
 
 
67
 
        ${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg"
68
 
        if [ $? = 0 ]; then
69
 
            log_success_msg
70
 
            touch $lock
71
 
            exit 0
72
 
        else
73
 
            log_failure_msg
74
 
            exit 1
75
 
        fi
76
 
        ;;
77
 
  stop)
78
 
        echo -n "Shutting down mcollective: "
79
 
 
80
 
        if [ -s ${pidfile} ]; then
81
 
          kill `cat ${pidfile}` >/dev/null 2>&1
82
 
        fi
83
 
        rm -f ${pidfile}
84
 
 
85
 
        log_success_msg
86
 
        rm -f $lock
87
 
        ;;
88
 
  restart)
89
 
        $0 stop
90
 
        sleep 2
91
 
        $0 start
92
 
        ;;
93
 
  condrestart)
94
 
        if [ -f $lock ]; then
95
 
            $0 stop
96
 
            # avoid race
97
 
            sleep 2
98
 
            $0 start
99
 
        fi
100
 
        ;;
101
 
  status)
102
 
        if [ -f ${lock} ]; then
103
 
            if [ -s ${pidfile} ]; then
104
 
               if [ -e /proc/`cat ${pidfile}` ]; then
105
 
                  echo "mcollectived (`cat ${pidfile}`) is running"
106
 
                  exit 0
107
 
               else
108
 
                  echo "mcollectived (`cat ${pidfile}`) is NOT running"
109
 
                  exit 1
110
 
               fi
111
 
            fi
112
 
        else
113
 
            echo "mcollectived: service not started"
114
 
            exit 1
115
 
        fi
116
 
  ;;
117
 
        force-reload)
118
 
                echo "not implemented"
119
 
        ;;
120
 
  *)
121
 
        echo "Usage: mcollectived {start|stop|restart|condrestart|status}"
122
 
        exit 1
123
 
        ;;
 
51
    start)
 
52
        echo -n "Starting mcollective: "
 
53
 
 
54
        if [ -f ${lock} ]; then
 
55
            # we were not shut down correctly
 
56
            if [ -s ${pidfile} ]; then
 
57
                kill `cat ${pidfile}` >/dev/null 2>&1
 
58
            fi
 
59
            rm -f ${pidfile}
 
60
 
 
61
            rm -f ${lock}
 
62
            sleep 2
 
63
        fi
 
64
 
 
65
        rm -f ${pidfile}
 
66
 
 
67
        ${mcollectived} --pid=${pidfile} --config="/etc/mcollective/server.cfg"
 
68
        if [ $? = 0 ]; then
 
69
            success $"mcollectived"
 
70
            touch $lock
 
71
            echo
 
72
            exit 0
 
73
        else
 
74
            failure
 
75
            echo
 
76
            exit 1
 
77
        fi
 
78
        ;;
 
79
    stop)
 
80
        echo -n "Shutting down mcollective: "
 
81
 
 
82
        if [ -s ${pidfile} ]; then
 
83
            kill `cat ${pidfile}` >/dev/null 2>&1
 
84
        fi
 
85
        rm -f ${pidfile}
 
86
 
 
87
        log_success_msg
 
88
        rm -f $lock
 
89
        ;;
 
90
    restart)
 
91
        $0 stop
 
92
        sleep 2
 
93
        $0 start
 
94
        ;;
 
95
    condrestart)
 
96
        if [ -f $lock ]; then
 
97
            $0 stop
 
98
            # avoid race
 
99
            sleep 2
 
100
            $0 start
 
101
        fi
 
102
        ;;
 
103
    status)
 
104
        if [ -f ${lock} ]; then
 
105
            if [ -s ${pidfile} ]; then
 
106
                if [ -e /proc/`cat ${pidfile}` ]; then
 
107
                    echo "mcollectived (`cat ${pidfile}`) is running"
 
108
                    exit 0
 
109
                else
 
110
                    echo "mcollectived (`cat ${pidfile}`) is NOT running"
 
111
                    exit 1
 
112
                fi
 
113
            fi
 
114
        else
 
115
            echo "mcollectived: service not started"
 
116
            exit 1
 
117
        fi
 
118
        ;;
 
119
    force-reload)
 
120
        echo "not implemented"
 
121
        ;;
 
122
    *)
 
123
        echo "Usage: mcollectived {start|stop|restart|condrestart|status}"
 
124
        exit 1
 
125
        ;;
124
126
esac
125
127
exit 0