#!/bin/sh # Start/stop the freeswitch daemon. # ### BEGIN INIT INFO # Provides: freeswitch # Required-Start: $network # Required-Stop: # Should-Start: # Should-Stop: # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: # Description: ### END INIT INFO PATH=/bin:/usr/bin:/sbin:/usr/sbin DESC="freeswitch" NAME=freeswitch DAEMON=/usr/local/freeswitch/bin/freeswitch DARGS="-nc" PIDFILE=/var/run/freeswitch.pid SCRIPTNAME=/etc/init.d/"$NAME" test -f $DAEMON || exit 0 . /lib/lsb/init-functions # there because it should be in /etc/default/locale. parse_environment () { for ENV_FILE in /etc/environment /etc/default/locale; do [ -r "$ENV_FILE" ] || continue [ -s "$ENV_FILE" ] || continue for var in LANG LANGUAGE LC_ALL LC_CTYPE; do value=`egrep "^${var}=" "$ENV_FILE" | tail -n1 | cut -d= -f2` [ -n "$value" ] && eval export $var=$value if [ -n "$value" ] && [ "$ENV_FILE" = /etc/environment ]; then log_warning_msg "/etc/environment has been deprecated for locale information; use /etc/default/locale for $var=$value instead" fi done done # Get the timezone set. if [ -z "$TZ" -a -e /etc/timezone ]; then TZ=`cat /etc/timezone` fi } # Parse the system's environment if [ "$READ_ENV" = "yes" ] ; then parse_environment fi case "$1" in start) log_daemon_msg "Starting freeswitch " "freeswitch" ulimit -s 240 OLDPID=`pgrep $NAME` NEWPID=`cat $PIDFILE` 2>/dev/null if [ "$OLDPID" = "$NEWPID" ] ; then echo "Service already running " && exit 1 else su - $NAME -c "$DAEMON $DARGS " >/dev/null 2>&1 fi sleep 1 ps -ef|grep $DAEMON|grep -v grep|awk '{print$2}' > $PIDFILE log_end_msg $? ;; stop) log_daemon_msg "Stopping freeswitch" "freeswitch" kill `cat $PIDFILE` >/dev/null 2>&1 RETVAL=$? [ $RETVAL -eq 0 ] && [ -e "$PIDFILE" ] && rm -f $PIDFILE log_end_msg $RETVAL ;; restart) log_daemon_msg "Restarting freeswitch" "freeswitch" $0 stop $0 start log_end_msg 0 ;; status) status_of_proc -p $PIDFILE $DAEMON $NAME && exit 0 || exit $? ;; *) log_action_msg "Usage: /etc/init.d/freeswitch {start|stop|status|restart|reload|force-reload}" exit 2 ;; esac exit 0
Sunday, December 30, 2012
freeswitch startup script
Subscribe to:
Post Comments (Atom)
Now that Google has pulled access to their Voice services, how would you retool this configuration?
ReplyDeleteHad some trouble with the git clone until I found that the location was changed.
ReplyDeletehttps://freeswitch.org/stash/scm/fs/freeswitch.git
It will be: git clone https://freeswitch.org/stash/scm/fs/freeswitch.git
Delete