mirror of
https://github.com/SlackBuildsOrg/slackbuilds
synced 2024-09-28 15:21:00 +02:00
4bd762f7d0
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
43 lines
825 B
Bash
43 lines
825 B
Bash
#! /bin/sh
|
|
|
|
CONFIG="/etc/turnserver.conf"
|
|
. /etc/default/turnserver
|
|
|
|
coturn_start() {
|
|
if [ ! -d $TURN_PID_PATH ]; then
|
|
mkdir -p $TURN_PID_PATH
|
|
chown $TURN_USER:$TURN_GROUP $TURN_PID_PATH
|
|
fi
|
|
if [ -x /usr/bin/turnserver ]; then
|
|
echo "Starting turnserver daemon: /usr/bin/turnserver"
|
|
su -l -c "/usr/bin/turnserver -o -c $CONFIG --pidfile $TURN_PID_PATH/turnserver.pid" $TURN_USER
|
|
fi
|
|
}
|
|
|
|
coturn_stop() {
|
|
echo "Stopping turnserver daemon: /usr/bin/turnserver"
|
|
kill $(cat $TURN_PID_PATH/turnserver.pid)
|
|
rm -f $TURN_PID_PATH/turnserver.pid
|
|
}
|
|
|
|
coturn_restart() {
|
|
coturn_stop
|
|
sleep 1
|
|
coturn_start
|
|
}
|
|
|
|
case "$1" in
|
|
'start')
|
|
coturn_start
|
|
;;
|
|
'stop')
|
|
coturn_stop
|
|
;;
|
|
'restart')
|
|
coturn_restart
|
|
;;
|
|
*)
|
|
echo "usage $0 start|stop|restart"
|
|
esac
|
|
|
|
exit 0
|