]> git.ipfire.org Git - thirdparty/freeswitch.git/blame - build/fs_ivrd.init.redhat
Merge pull request #2155 from signalwire/move_to_packetizer
[thirdparty/freeswitch.git] / build / fs_ivrd.init.redhat
CommitLineData
c1da705e
JM
1#!/bin/bash
2#
3# /etc/rc.d/init.d/fs_ivrd
4#
5# The FreeSwitch Open Source Voice Platform
6#
7# chkconfig: 345 89 14
8# description: Starts and stops the fs_ivrd server daemon
9# processname: fs_ivrd
10# pidfile: /usr/local/fs_ivrd/run/fs_ivrd.pid
11#
12
13# Source function library.
14. /etc/init.d/functions
15
16PROG_NAME=fs_ivrd
17PID_FILE=${PID_FILE-/usr/local/freeswitch/run/fs_ivrd.pid}
18#FS_USER=${FS_USER-freeswitch}
19FS_USER=${FS_USER-root}
20FS_FILE=${FS_FILE-/usr/local/freeswitch/bin/fs_ivrd}
21FS_HOME=${FS_HOME-/usr/local/freeswitch}
22LOCK_FILE=/var/lock/subsys/fs_ivrd
23IVRD_ARGS="-h localhost -p 9090"
24RETVAL=0
25
26# Source options file
27if [ -f /etc/sysconfig/fs_ivrd ]; then
28 . /etc/sysconfig/fs_ivrd
29fi
30
31# <define any local shell functions used by the code that follows>
32
33start() {
34 echo -n "Starting $PROG_NAME: "
35 if [ -e $LOCK_FILE ]; then
36 if [ -e $PID_FILE ] && [ -e /proc/`cat $PID_FILE` ]; then
37 echo
38 echo -n $"$PROG_NAME is already running.";
39 failure $"$PROG_NAME is already running.";
40 echo
41 return 1
42 fi
43 fi
44 cd $FS_HOME
45 daemon --user $FS_USER --pidfile $PID_FILE "$FS_FILE $IVRD_ARGS $IVRD_PARAMS >/dev/null 2>&1 &"
46 echo
47 RETVAL=$?
48 [ $RETVAL -eq 0 ] && touch $LOCK_FILE;
49 echo
50 return $RETVAL
51}
52
53stop() {
54 echo -n "Shutting down $PROG_NAME: "
55 if [ ! -e $LOCK_FILE ]; then
56 echo
57 echo -n $"cannot stop $PROG_NAME: $PROG_NAME is not running."
58 failure $"cannot stop $PROG_NAME: $PROG_NAME is not running."
59 echo
60 return 1;
61 fi
62 cd $FS_HOME
63 $FS_FILE -stop > /dev/null 2>&1
64 killproc $PROG_NAME
65 RETVAL=$?
66 echo
67 [ $RETVAL -eq 0 ] && rm -f $LOCK_FILE;
68 return $RETVAL
69}
70
71rhstatus() {
72 status $PROG_NAME;
73}
74
75case "$1" in
76 start)
77 start
78 ;;
79 stop)
80 stop
81 ;;
82 status)
83 status $PROG_NAME
84 RETVAL=$?
85 ;;
86 restart)
87 stop
88 start
89 ;;
90 reload)
91# <cause the service configuration to be reread, either with
92# kill -HUP or by restarting the daemons, in a manner similar
93# to restart above>
94 ;;
95 condrestart)
96 ;;
97 *)
98 echo "Usage: $PROG_NAME {start|stop|status|restart}"
99 exit 1
100 ;;
101esac
102exit $RETVAL