blob: 1e6c66d418ad87c8a3988c0672f9c111f5ce00c3 (
about) (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
|
#!/bin/sh
#
# Start/stop/restart the FreeSWITCH daemon
# Written by Mario Preksavec <mario@slackware.hr>
USER=freeswitch
GROUP=freeswitch
BIN_FILE=/opt/freeswitch/bin/freeswitch
PID_FILE=/var/run/freeswitch/freeswitch.pid
RUN_ARGS="-nc -rp -nonat"
set_limits() {
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 240
ulimit -l unlimited
}
start() {
echo -n "Starting FreeSWITCH: "
if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then
echo "Already running."
else
set_limits
$BIN_FILE $RUN_ARGS -u $USER -g $GROUP >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Started."
else
echo "Failed starting."
fi
fi
}
stop() {
echo -n "Stopping FreeSWITCH: "
if [ -e $PID_FILE ] && [ -e /proc/$(cat $PID_FILE) ]; then
$BIN_FILE -stop >/dev/null 2>&1
if [ $? -eq 0 ]; then
echo "Stopped."
else
echo "Failed stopping."
fi
else
echo "Not running."
fi
}
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 5
start
;;
*)
echo "USAGE: $0 {start|stop|restart}"
;;
esac
|