Commit 55bf232a authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Applying some RPM work from earlier in the week. (and testing svn access)

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@7924 b35dd754-fafc-0310-a699-88a17e54d16e
parent df699671
...@@ -5,3 +5,7 @@ ...@@ -5,3 +5,7 @@
# If there is a different user you would like to run openfire as, # If there is a different user you would like to run openfire as,
# change the following line # change the following line
#OPENFIRE_USER="jive" #OPENFIRE_USER="jive"
# If you wish to change the location of the openfire pid file,
# change the following line
#OPENFIRE_PIDFILE="/var/run/openfired.pid"
#!/bin/sh #!/bin/bash
#
# openfired stops and starts the openfire XMPP service # openfired Stops and starts the Openfire XMPP service.
# #
# chkconfig: 2345 99 1 # chkconfig: 2345 99 1
# description: Used to start and stop the openfire XMPP server # description: Openfire is an XMPP server, which is a server that facilitates \
# # XML based communication, such as chat.
# Script used to start openfire as daemon # config: /opt/openfire/conf/openfire.xml
# The script has currently been tested on Redhat Fedora Core 3, # pidfile: /var/run/openfired.pid
# but should theoretically work on most UNIX like systems #
# # This script has currently been tested on Redhat and CentOS based systems,
# before running this script make sure $OPENFIRE_HOME/bin/openfire.sh is # but should theoretically work on most UNIX like systems
# executable by the user you want to run openfire as #
# (chmod +x $OPENFIRE_HOME/bin/openfire.sh) # Before running this script make sure $OPENFIRE_HOME/bin/openfire.sh is
# # executable by the user you want to run openfire as
# This script should be copied into /etc/init.d and linked into # (chmod +x $OPENFIRE_HOME/bin/openfire.sh)
# your default runlevel directory. #
# You can find your default runlevel directory by typing: # This script should be copied into /etc/init.d and linked into
# grep default /etc/inittab # your default runlevel directory.
# # You can find your default runlevel directory by typing:
# Link to the directory like follows # grep default /etc/inittab
# cd /etc/rc<num>.d #
# ln -s ../init.d/openfired S99openfired # Link to the directory like follows
# # cd /etc/rc<num>.d
# ln -s ../init.d/openfired S99openfired
# Get config. #
test -f /etc/sysconfig/openfire && . /etc/sysconfig/openfire
# Get config.
# If openfire user is not set in sysconfig, set to jive. [ -f /etc/sysconfig/openfire ] && . /etc/sysconfig/openfire
[ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive
# If openfire user is not set in sysconfig, set to jive.
# ----------------------------------------------------------------- [ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive
# If a openfire home variable has not been specified, try to determine it # If pid file path is not set in sysconfig, set to /var/run/openfired.pid.
if [ ! $OPENFIRE_HOME ]; then [ -z "$OPENFIRE_PIDFILE" ] && OPENFIRE_PIDFILE=/var/run/openfired.pid
if [ -d "/opt/openfire" ]; then
OPENFIRE_HOME="/opt/openfire" # -----------------------------------------------------------------
elif [ -d "/usr/local/openfire" ]; then
OPENFIRE_HOME="/usr/local/openfire" # If a openfire home variable has not been specified, try to determine it
else if [ ! $OPENFIRE_HOME ]; then
echo "Could not find Openfire installation under /opt or /usr/local" if [ -d "/opt/openfire" ]; then
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME" OPENFIRE_HOME="/opt/openfire"
exit 1 elif [ -d "/usr/local/openfire" ]; then
fi OPENFIRE_HOME="/usr/local/openfire"
fi else
echo "Could not find Openfire installation under /opt or /usr/local"
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME"
function execCommand() { exit 1
OLD_PWD=`pwd` fi
cd $OPENFIRE_HOME/bin fi
CMD="./openfire.sh $1"
su -c "$CMD" $OPENFIRE_USER & RETVAL=0
sleep 1 # allows prompt to return prog="openfired"
cd $OLD_PWD
} start() {
OLD_PWD=`pwd`
cd $OPENFIRE_HOME/bin
start() {
execCommand "start" # Start daemons.
} echo -n $"Starting $prog: "
stop() { CMD=./openfire.sh
execCommand "stop" su -s /bin/bash -c "$CMD" $OPENFIRE_USER &
} RETVAL=$?
if [ $RETVAL -eq 0 -a ! -z "$OPENFIRE_PIDFILE" ]; then
case "$1" in echo $! > $OPENFIRE_PIDFILE
start) fi
start
;; echo
stop)
stop [ $RETVAL -eq 0 ] && touch /var/lock/subsys/openfired
;;
restart) sleep 1 # allows prompt to return
stop cd $OLD_PWD
sleep 10 # since stop is backgrounded }
start
;; stop() {
status) # Stop daemons.
retval=$(pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire.sh > /dev/null ; echo $?) echo -n $"Shutting down $prog: "
if [ "$retval" = "0" ] ; then
echo "openfire is running" [ -f $OPENFILE_PIDFILE ] && kill `cat $OPENFIRE_PIDFILE`
exit 0 RETVAL=$?
else echo
echo "openfire is not running"
exit 0 [ $RETVAL -eq 0 -a -f $OPENFIRE_PIDFILE ] && rm -f $OPENFIRE_PIDFILE
fi [ $RETVAL -eq 0 -a -f /var/lock/subsys/openfired ] && rm -f /var/lock/subsys/openfired
;; }
*)
echo "Usage $0 {start|stop|restart|status}"
exit 1 case "$1" in
esac start)
start
exit 0 ;;
stop)
stop
;;
restart)
stop
sleep 10 # since stop is backgrounded
start
;;
status)
retval=$(pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire.sh > /dev/null ; echo $?)
if [ "$retval" = "0" ] ; then
echo "openfire is running"
exit 0
else
echo "openfire is not running"
exit 0
fi
;;
*)
echo "Usage $0 {start|stop|restart|status}"
exit 1
esac
exit 0
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment