Commit efbf1c23 authored by Daniel Henninger's avatar Daniel Henninger Committed by dhenninger

Moved work on new rpm out of the way. Restored original openfired init script...

Moved work on new rpm out of the way.  Restored original openfired init script with renaming work done for openfire.

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@8036 b35dd754-fafc-0310-a699-88a17e54d16e
parent 6e92af10
#!/bin/sh #!/bin/sh
#
# 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: Openfire is an XMPP server, which is a server that facilitates \ # description: Used to start and stop the openfire XMPP server
# XML based communication, such as chat. #
# config: /opt/openfire/conf/openfire.xml # Script used to start openfire as daemon
# config: /etc/sysconfig/openfire # The script has currently been tested on Redhat Fedora Core 3,
# pidfile: /var/run/openfire.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 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)
# 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 $90openfired
# Link to the directory like follows #
# cd /etc/rc<num>.d
# ln -s ../init.d/openfired S99openfired # Set this to tell this script where openfire lives
# # If this is not set the script will look for /opt/openfire, then /usr/local/openfire
#export OPENFIRE_HOME=
PATH=/sbin:/bin:/usr/bin:/usr/sbin
RETVAL=0 # If there is a different user you would like to run this script as,
PROG="openfire" # change the following line
export OPENFIRE_USER=jive
# Check that we are root ... so non-root users stop here
[ "`id -u`" = 0 ] || exit 1 # -----------------------------------------------------------------
# Get config. # If a openfire home variable has not been specified, try to determine it
[ -f "/etc/sysconfig/$PROG" ] && . /etc/sysconfig/$PROG if [ ! $OPENFIRE_HOME ]; then
if [ -d "/opt/openfire" ]; then
# If openfire user is not set in sysconfig, set to jive. OPENFIRE_HOME="/opt/openfire"
[ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive elif [ -d "/usr/local/openfire" ]; then
OPENFIRE_HOME="/usr/local/openfire"
# If pid file path is not set in sysconfig, set to /var/run/openfired.pid. else
[ -z "$OPENFIRE_PIDFILE" ] && OPENFIRE_PIDFILE=/var/run/$PROG.pid echo "Could not find Openfire installation under /opt or /usr/local"
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME"
# ----------------------------------------------------------------- exit 1
fi
# If a openfire home variable has not been specified, try to determine it fi
if [ -z "$OPENFIRE_HOME" ]; then
if [ -d "/opt/openfire" ]; then
OPENFIRE_HOME="/opt/openfire" function execCommand() {
elif [ -d "/usr/local/openfire" ]; then OLD_PWD=`pwd`
OPENFIRE_HOME="/usr/local/openfire" cd $OPENFIRE_HOME/bin
else CMD="./openfire.sh $1"
echo "Could not find Openfire installation under /opt or /usr/local" su -c "$CMD" $OPENFIRE_USER &
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME" sleep 1 # allows prompt to return
exit 1 cd $OLD_PWD
fi }
fi
[ -z "$OPENFIRE_LOGDIR" ] && OPENFIRE_LOGDIR=$OPENFIRE_HOME/logs start() {
execCommand "start"
OPENFIRE_CMD="$OPENFIRE_HOME/bin/openfire.sh" }
[ -f "$OPENFIRE_CMD" ] || exit 1
stop() {
start() { execCommand "stop"
OLD_PWD=`pwd` }
cd $OPENFIRE_LOGDIR
# Start daemons. case "$1" in
echo -n "Starting $PROG: " start)
start
su -s /bin/sh -c "$OPENFIRE_CMD" $OPENFIRE_USER > nohup.out 2>&1 & ;;
RETVAL=$? stop)
stop
if [ $RETVAL -eq 0 -a ! -z "$OPENFIRE_PIDFILE" ]; then ;;
echo $! > $OPENFIRE_PIDFILE restart)
fi stop
sleep 10 # since stop is backgrounded
echo start
;;
[ $RETVAL -eq 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/$PROG status)
retval=$(pgrep -u $OPENFIRE_USER -f $OPENFIRE_HOME/bin/openfire > /dev/null ; echo $?)
sleep 1 # allows prompt to return if [ "$retval" = "0" ] ; then
cd $OLD_PWD echo "openfire is running"
} exit 0
else
stop() { echo "openfire is not running"
# Stop daemons. exit 0
echo -n "Shutting down $PROG: " fi
;;
[ -f "$OPENFILE_PIDFILE" ] && kill `cat $OPENFIRE_PIDFILE` *)
RETVAL=$? echo "Usage $0 {start|stop|restart|status}"
echo exit 1
esac
[ $RETVAL -eq 0 -a -f "$OPENFIRE_PIDFILE" ] && rm -f $OPENFIRE_PIDFILE
[ $RETVAL -eq 0 -a -f "/var/lock/subsys/$PROG" ] && rm -f /var/lock/subsys/$PROG exit 0
}
restart() {
stop
sleep 10 # give it a few moments to shut down
start
}
condrestart() {
[ -e "/var/lock/subsys/$PROG" ] && restart
return 0
}
status() {
pid=`cat $OPENFIRE_PIDFILE 2>&1`
if [ "$?" = "1" ]; then
echo "openfire is not running"
RETVAL=0
else
ps -p $pid > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo "openfire is running"
RETVAL=0
else
echo "openfire is not running"
RETVAL=0
fi
fi
}
# Handle how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
condrestart
;;
status)
status
;;
*)
echo "Usage $0 {start|stop|restart|status|condrestart}"
RETVAL=1
esac
exit $RETVAL
#!/bin/sh
#
# openfired Stops and starts the Openfire XMPP service.
#
# chkconfig: 2345 99 1
# description: Openfire is an XMPP server, which is a server that facilitates \
# XML based communication, such as chat.
# config: /opt/openfire/conf/openfire.xml
# config: /etc/sysconfig/openfire
# pidfile: /var/run/openfire.pid
#
# This script has currently been tested on Redhat and CentOS based systems,
# but should theoretically work on most UNIX like systems
#
# Before running this script make sure $OPENFIRE_HOME/bin/openfire.sh is
# executable by the user you want to run openfire as
# (chmod +x $OPENFIRE_HOME/bin/openfire.sh)
#
# This script should be copied into /etc/init.d and linked into
# your default runlevel directory.
# You can find your default runlevel directory by typing:
# grep default /etc/inittab
#
# Link to the directory like follows
# cd /etc/rc<num>.d
# ln -s ../init.d/openfired S99openfired
#
PATH=/sbin:/bin:/usr/bin:/usr/sbin
RETVAL=0
PROG="openfire"
# Check that we are root ... so non-root users stop here
[ "`id -u`" = 0 ] || exit 1
# Get config.
[ -f "/etc/sysconfig/$PROG" ] && . /etc/sysconfig/$PROG
# If openfire user is not set in sysconfig, set to jive.
[ -z "$OPENFIRE_USER" ] && OPENFIRE_USER=jive
# If pid file path is not set in sysconfig, set to /var/run/openfired.pid.
[ -z "$OPENFIRE_PIDFILE" ] && OPENFIRE_PIDFILE=/var/run/$PROG.pid
# -----------------------------------------------------------------
# If a openfire home variable has not been specified, try to determine it
if [ -z "$OPENFIRE_HOME" ]; then
if [ -d "/opt/openfire" ]; then
OPENFIRE_HOME="/opt/openfire"
elif [ -d "/usr/local/openfire" ]; then
OPENFIRE_HOME="/usr/local/openfire"
else
echo "Could not find Openfire installation under /opt or /usr/local"
echo "Please specify the Openfire installation location in environment variable OPENFIRE_HOME"
exit 1
fi
fi
[ -z "$OPENFIRE_LOGDIR" ] && OPENFIRE_LOGDIR=$OPENFIRE_HOME/logs
OPENFIRE_CMD="$OPENFIRE_HOME/bin/openfire.sh"
[ -f "$OPENFIRE_CMD" ] || exit 1
start() {
OLD_PWD=`pwd`
cd $OPENFIRE_LOGDIR
# Start daemons.
echo -n "Starting $PROG: "
su -s /bin/sh -c "$OPENFIRE_CMD" $OPENFIRE_USER > nohup.out 2>&1 &
RETVAL=$?
if [ $RETVAL -eq 0 -a ! -z "$OPENFIRE_PIDFILE" ]; then
echo $! > $OPENFIRE_PIDFILE
fi
echo
[ $RETVAL -eq 0 -a -d /var/lock/subsys ] && touch /var/lock/subsys/$PROG
sleep 1 # allows prompt to return
cd $OLD_PWD
}
stop() {
# Stop daemons.
echo -n "Shutting down $PROG: "
[ -f "$OPENFILE_PIDFILE" ] && kill `cat $OPENFIRE_PIDFILE`
RETVAL=$?
echo
[ $RETVAL -eq 0 -a -f "$OPENFIRE_PIDFILE" ] && rm -f $OPENFIRE_PIDFILE
[ $RETVAL -eq 0 -a -f "/var/lock/subsys/$PROG" ] && rm -f /var/lock/subsys/$PROG
}
restart() {
stop
sleep 10 # give it a few moments to shut down
start
}
condrestart() {
[ -e "/var/lock/subsys/$PROG" ] && restart
return 0
}
status() {
pid=`cat $OPENFIRE_PIDFILE 2>&1`
if [ "$?" = "1" ]; then
echo "openfire is not running"
RETVAL=0
else
ps -p $pid > /dev/null 2>&1
if [ "$?" = "0" ]; then
echo "openfire is running"
RETVAL=0
else
echo "openfire is not running"
RETVAL=0
fi
fi
}
# Handle how we were called.
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
restart
;;
condrestart)
condrestart
;;
status)
status
;;
*)
echo "Usage $0 {start|stop|restart|status|condrestart}"
RETVAL=1
esac
exit $RETVAL
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