Add the freeswitch service to centos and run it automatically upon startup.

Source: Internet
Author: User
Tags freeswitch

Create the/etc/init. d/freeswitch script. The script content is as follows:

#! /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/networkPATH=/sbin:/usr/sbin:/bin:/usr/bin:/usr/local/freeswitch/binDESC="FreeSwitch Voice Switching System"NAME=freeswitchDAEMON=/usr/local/freeswitch/bin/$NAMEDAEMON_ARGS="-nc"PIDFILE=/usr/local/freeswitch/log/$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=freeswitchdo_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        ;;esacexit $RETVAL

Add the script executable permission:

chmod +x /etc/init.d/freeswitch

Add startup service:

chkconfig --add freeswitch 

 

Above, all. PS. If the FS is found to be disconnected, it may be caused by the firewall. If you are rude, close the firewall.

Add the freeswitch service to centos and run it automatically upon startup.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.