Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 3dd763b3ef
Fetching contributors…

Cannot retrieve contributors at this time

129 lines (114 sloc) 3.466 kb
#!/bin/bash
# sipxrelay - Startup script for sipxrelay
# chkconfig: 35 85 15
# description: sipxrelay is a media relay for telecommunications
# processname: sipxrelay
# Copyright (c) 2012 eZuce, Inc. All rights reserved.
# Contributed to SIPfoundry under a Contributor Agreement
# This software is free software; you can redistribute it and/or modify it under
# the terms of the Affero General Public License (AGPL) as published by the
# Free Software Foundation; either version 3 of the License, or (at your option)
# any later version.
# This software is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
# details.
. /etc/rc.d/init.d/functions || exit 1
. @SIPX_LIBEXECDIR@/sipx-utils.sh || exit 1
prog=sipxrelay
pidfile="@SIPX_RUNDIR@/sipxrelay.pid"
[ -e @SIPX_CONFDIR@/${prog}rc ] && . @SIPX_CONFDIR@/sysconfig/${prog}rc
checkRunningInstance() {
if [ -f "${pidfile}" ]; then
pid=`cat ${pidfile}`
if checkpid $pid 2>&1; then
echo "Process $prog is already running with pid $pid"
exit 1
fi
fi
}
start() {
checkRunningInstance
JavaCmd=`@SIPX_BINDIR@/sipx-config --java`
Dependencies=`@SIPX_BINDIR@/java-dep -d @SIPX_JAVADIR@/sipXcommons @relay_PKGS@`
export CLASSPATH=`echo @SIPX_JAVADIR@/sipXbridge/*.jar ${Dependencies} | sed -e 's/ /:/g'`
setJavaSslOpts
# procname is there so cfengine can find it
Command="$JavaCmd \
-Dprocname=sipxrelay \
-Dconf.dir=@SIPX_CONFDIR@ \
-Dsipxrelay.command=start \
$JavaSslOpts \
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger \
org.sipfoundry.sipxrelay.SymmitronServer \
$Args"
if [ -n "${NoFork}" ] ; then
runuser -s /bin/bash @SIPXPBXUSER@ -c "${Command}"
else
echo -n $"Starting $prog: "
runuser -s /bin/bash @SIPXPBXUSER@ -c "${Command}" >/dev/null 2>&1 &
echo $! > ${pidfile}
echo_success
fi
}
stop() {
echo -n $"Stopping sipxrelay: "
killproc -p "${pidfile}" -t30 -TERM "sipxrelay"
Status=$?
echo
[ $Status -eq 0 ] && rm -f "${pidfile}"
}
restart() {
stop
start
}
configtest() {
Status=0
logfile="@SIPX_LOGDIR@/sipxrelay.log"
if [ -e $logfile -a ! -w $logfile ]
then
echo "Log file '$logfile' exists but is not writable by user '@SIPXPBXUSER@'." >&2
Status=1
fi
JavaCmd=`@SIPX_BINDIR@/sipx-config --java`
Dependencies=`@SIPX_BINDIR@/java-dep -d @SIPX_JAVADIR@/sipXcommons @relay_PKGS@`
export CLASSPATH=`echo @SIPX_JAVADIR@/sipXbridge/*.jar ${Dependencies} | sed -e 's/ /:/g'`
setJavaSslOpts
# procname is there so cfengine can find it
Command="$JavaCmd \
-Dconf.dir=@SIPX_CONFDIR@ \
-Dsipxrelay.command=configtest \
$JavaSslOpts \
-Dorg.apache.commons.logging.Log=org.apache.commons.logging.impl.Log4JLogger \
org.sipfoundry.sipxrelay.SymmitronServer \
$Args"
exec $Command
}
case "$1" in
nofork)
NoFork=1
start
;;
start)
start
;;
stop)
stop
;;
restart|reload|force-reload)
restart
;;
condrestart)
[ -f ${pidfile} ] && restart || :
;;
status)
status -p ${pidfile} java
;;
configtest)
configtest
;;
*)
echo "Usage: $0 {start|stop|status|restart|reload|force-reload|condrestart|nofork}"
Status=1
esac
exit $Status
Jump to Line
Something went wrong with that request. Please try again.