Subversion Repositories configs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
4 - 1
#!/bin/bash
2
#
3
# Licensed to the Apache Software Foundation (ASF) under one
4
# or more contributor license agreements.  See the NOTICE file
5
# distributed with this work for additional information
6
# regarding copyright ownership.  The ASF licenses this file
7
# to you under the Apache License, Version 2.0 (the
8
# "License"); you may not use this file except in compliance
9
# with the License.  You may obtain a copy of the License at
10
#
11
#   http://www.apache.org/licenses/LICENSE-2.0
12
#
13
# Unless required by applicable law or agreed to in writing,
14
# software distributed under the License is distributed on an
15
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16
# KIND, either express or implied.  See the License for the
17
# specific language governing permissions and limitations
18
# under the License.
19
#
20
#
21
# qpidd        Startup script for the Qpid messaging daemon.
22
#
23
 
24
### BEGIN INIT INFO
25
# Provides: qpidd
26
# Required-Start: $local_fs
27
# Required-Stop: $local_fs
28
# Default-Start:
29
# Default-Stop: 0 1 2 3 4 5 6
30
# Short-Description: start or stop qpidd
31
# Description: Qpidd is an AMQP broker. It receives, stores, routes and	forwards messages using the AMQP protcol.
32
### END INIT INFO
33
 
34
# chkconfig: - 85 15
35
# description: Qpidd is an AMQP broker. It receives, stores, routes and forwards messages using the AMQP protcol.
36
# processname: qpidd
37
 
38
prog=qpidd
39
lockfile=/var/lock/subsys/$prog
40
pidfile=/var/run/qpidd.pid
41
 
42
# Source function library.
43
. /etc/rc.d/init.d/functions
44
 
45
if [ -f /etc/sysconfig/$prog ] ; then
46
	. /etc/sysconfig/$prog
47
fi
48
 
49
RETVAL=0
50
 
51
#ensure binary is present and executable
52
if [[ !(-x /usr/sbin/$prog) ]] ; then
53
    echo "/usr/sbin/$prog not found or not executable"
54
    exit 5
55
fi
56
 
57
#ensure user has sufficient permissions
58
runuser -s /bin/sh qpidd -c "echo x > /dev/null" 2> /dev/null || RETVAL=4
59
if [ $RETVAL = 4 ]; then
60
    echo "user had insufficient privilege";
61
    exit $RETVAL
62
fi
63
 
64
start() {
65
        [[ $QPID_DATA_DIR ]] || QPID_DATA_DIR=/var/lib/qpidd
66
        echo -n $"Starting Qpid AMQP daemon: "
67
	daemon --pidfile $pidfile --check $prog --user qpidd /usr/sbin/$prog --data-dir $QPID_DATA_DIR --daemon $QPIDD_OPTIONS
68
	RETVAL=$?
69
	echo
70
	[ $RETVAL = 0 ] && touch $lockfile
71
	if [ $RETVAL = 0 ]; then
72
	    touch $pidfile
73
	    chown qpidd.qpidd $pidfile
74
            [ -x /sbin/restorecon ] && /sbin/restorecon $pidfile
75
	    runuser - -s /bin/sh qpidd -c "/usr/sbin/$prog --check > $pidfile"
76
	fi
77
	return $RETVAL
78
}
79
 
80
stop() {
81
	echo -n $"Stopping Qpid AMQP daemon: "
82
	killproc -p ${pidfile} $prog
83
	RETVAL=$?
84
	echo
85
	[ $RETVAL = 0 ] && rm -f ${lockfile} ${pidfile}
86
}
87
 
88
reload() {
89
	echo 1>&2 $"$0: reload not supported"
90
	exit 3
91
}
92
 
93
restart() {
94
	stop
95
	start
96
}
97
 
98
# See how we were called.
99
case "$1" in
100
  start|stop|restart|reload)
101
	$1
102
	;;
103
  status)
104
	status $prog
105
	RETVAL=$?
106
	;;
107
  force-reload)
108
	restart
109
	;;
110
  try-restart|condrestart)
111
	[ -e $lockfile ] && restart || :
112
	;;
113
  *)
114
	echo 1>&2 $"Usage: $0 {start|stop|status|restart|condrestart|try-restart|force-reload}"
115
	exit 2
116
esac
117
 
118
exit $RETVAL