LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 12-12-2011, 03:02 PM   #1
Toomas
LQ Newbie
 
Registered: Oct 2010
Location: Tallinn
Distribution: CentOS 5.5
Posts: 18

Rep: Reputation: 1
Freeswitch launch on system startup – Fedora 16


Hi,

I've installed FreeSWITCH on Fedora 16. The FreeSWITCH has been compiled from source (there is no rpm). 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
Code:
#service freeswitch start
Starting freeswitch (via systemctl):                       [  OK  ]
... but FreeSWITCH doesnt actually start.

Running
Code:
#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
Code:
# 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
Code:
#/usr/local/freeswitch/bin/freeswitch
works fine.

Please help. Thanks. The init script is below:

cat /etc/init.d/freeswitch
Code:
#! /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
 
Old 12-13-2011, 08:28 AM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
Did you create a freeswitch user? Check your kernel messages to see if the freeswitch daemon tried to start but couldn't.

The message about systemctl indicates that your system uses systemd. My system just started using it, so I'm not very knowledgeable on systemd yet. I don't think that freeswitch adds the files needed for systemd, but this may not be needed if fedora 16 allows you to use either.

Try the command:
systemctl --type service | grep switch
Does it indicate "failed"?

Also, your config script header looks like it may be missing some items. Check the insserv manpage:
Code:
       insserv enables an installed system init script (`boot script') by reading the comment header of the script, e.g.:

         ### BEGIN INIT INFO
         # Provides:          boot_facility_1 [ boot_facility_2 ...]
         # Required-Start:    boot_facility_1 [ boot_facility_2 ...]
         # Required-Stop:     boot_facility_1 [ boot_facility_2 ...]
         # Should-Start:      boot_facility_1 [ boot_facility_2 ...]
         # Should-Stop:       boot_facility_1 [ boot_facility_2 ...]
         # X-Start-Before:    boot_facility_1 [ boot_facility_2 ...]
         # X-Stop-After:      boot_facility_1 [ boot_facility_2 ...]
         # Default-Start:     run_level_1 [ run_level_2 ...]
         # Default-Stop:      run_level_1 [ run_level_2 ...]
         # X-Interactive:     true
         # Short-Description: single_line_description
         # Description:       multiline_description
         ### END INIT INFO
Check the manpage on your system and any /etc/init.d/skeleton file. For example, should the runlevels be separated with spaces? Mine have Should-Start: & Should-Stop, and don't have a chkconfig: line.

Last edited by jschiwal; 12-13-2011 at 10:22 AM.
 
  


Reply

Tags
chkconfig


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
superkaramba launch at startup marcoguillen Linux - Software 2 03-20-2007 08:38 PM
firestarter launch at startup, ok? dapper128 Linux - Security 4 09-11-2006 04:58 PM
Fedora 3, system hangs in startup. S-ATA problem? e99swa Fedora 1 04-02-2005 07:20 PM
Have Firefox Launch X on startup Johnathan4 Linux - Software 1 02-12-2005 11:02 AM
Launch commands at BlackBox startup MediaTracker Linux - Software 3 10-16-2003 11:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:01 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration