[Freeswitch-users] Freeswitch on system startup on Fedora 16

T T quiet.ordinary.man at gmail.com
Sun Dec 11 13:54:43 MSK 2011


Hi,

I've installed FreeSWITCH on Fedora 16. I want FreeSWITCH to be
launched  at system startup.

I've put a bash script from
http://wiki.freeswitch.org/wiki/Freeswitch_init#Fedora

into /etc/init.d directory with corrected paths, and run
#chckconfig freeswitch on

FreeSWITCH doesnt start at system startup.

Running
#service freeswitch start
Starting freeswitch (via systemctl):                       [  OK  ]

... but FreeSWITCH doesnt actually start.

Running
#systemctl enable freeswitch.service
freeswitch.service is not a native service, redirecting to /sbin/chkconfig.
Executing /sbin/chkconfig freeswitch on
Warning: unit files do not carry install information. No operation executed.

Running
# chkconfig --list freeswitch

Note: This output shows SysV services only and does not include native
      systemd services. SysV configuration data might be overridden by native
      systemd configuration.

freeswitch     	0:off	1:off	2:on	3:on	4:on	5:on	6:off

Running
#/usr/local/freeswitch/bin/freeswitch

works fine.

Please help. Thanks. The init script is below:

cat /etc/init.d/freeswitch
#! /bin/sh
#
# freeswitch:       Starts the freeswitch Daemon
#
# chkconfig: 345 96 02
# processname: freeswitch
# description: Freeswitch fedora init script \
# config:
# Author: gled

# Source function library.
. /etc/init.d/functions
. /etc/sysconfig/network

PATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/freeswitch/bin
DESC="FreeSwitch Voice Switching System"
NAME=freeswitch
DAEMON=/usr/local/freeswitch/bin/$NAME
DAEMON_ARGS="-nc"
PIDFILE=/var/run/freeswitch/$NAME.pid

## SECURITY NOTE: To run as non-root, create a new user for FreeSWITCH
and set these variables (FS_GROUP is optional).
##
FS_USER=freeswitch
#FS_GROUP=freeswitch

do_setlimits() {
       ulimit -c unlimited
       ulimit -d unlimited
       ulimit -f unlimited
       ulimit -i unlimited
       ulimit -n 999999
       ulimit -q unlimited
       ulimit -u unlimited
       ulimit -v unlimited
       ulimit -x unlimited
       ulimit -s 244
       ulimit -l unlimited
       return 0
}

base=${0##*/}
do_start() {
       if [ -n "${FS_USER}" ]; then
               DAEMON_ARGS="${DAEMON_ARGS} -u ${FS_USER}"
       fi

       if [ -n "${FS_GROUP}" ]; then
               DAEMON_ARGS="${DAEMON_ARGS} -g ${FS_GROUP}"
       fi

       do_setlimits
       $DAEMON $DAEMON_ARGS
       RETVAL=$?
       if [ $RETVAL = 0 ]; then
               success $"$base startup"
       else
               failure $"$base startup"
       fi
       echo
       return $RETVAL
}

do_stop() {
       $DAEMON -stop
       RETVAL=$?
       [ $RETVAL = 0 ] && success $"$base shutdown" || failure $"$base shutdown"
       rm -f $LOCKFILE
       echo
       return $RETVAL
}

# See how we were called.
case "$1" in
 start)
       do_start
       ;;
 stop)
       do_stop
       ;;
 restart)
       do_stop
       echo "Waiting for daemon to exit..."
       sleep 5
       do_start
       ;;
 *)
       echo $"Usage: $0 {start|stop}"
       exit 2
       ;;
esac

exit $RETVAL



Join us at ClueCon 2011 Aug 9-11, 2011
More information about the FreeSWITCH-users mailing list