forked from norman/fusionpbx-install.sh-github-mirror
Devuan: update all install scripts from debian (#390)
* devuan: pull fail2ban updates from debian installer * devuan: merge updates to postgresql.sh from debian * devuan: pull updated resources/backup scripts from debian * devuan: merge and update php installer scripts * devuan: merged changes to reset_admin_password.sh from debian * devuan: fix release name typo for chimaera * devuan: merge iptables changes from debian * devuan: merge nginx changes from debian * devuan: merge letsencrypt.sh from debian * devuan: merge main install scripts and config from debian * devuan: simplify sngrep install, its in all maintained releases * devuan: merge main install script updates from debian * devuan: finish.sh: use /usr/sbin/service for restart * devuan: postgresql.sh: fix syntax error * devuan: update and unify sysvinit setup there is no sysvinit package available from freeswitch, usethe same init and defaults file for package and source install * devuan: add equvalent debian releasesto environment.sh * devuan: merge changes to switch* from debian * devuan: switch: use os_codenam_debian to add repos * devuan: olny stop ufw if it was installed * devuan: update config.sh defaults * devuan: remove systemd-specifics from switch package installation * devuan: install postgres before freeswitch * devuan: removed libyuv-dev installation, embedded in freeswitch * devuan: fix failing move of freeswitch music * devuan: removed another libyuv-dev installation, embedded in freeswitch * devuan: revert freeswitch script dir setting in /etc/default * devuan: Enable mod_av for the install. (#389) * devuan: merge improved nginx ssl settings (#388)
This commit is contained in:
133
devuan/resources/switch/freeswitch.init
Executable file
133
devuan/resources/switch/freeswitch.init
Executable file
@@ -0,0 +1,133 @@
|
||||
#!/bin/sh
|
||||
### -*- mode:shell-script; indent-tabs-mode:nil; sh-basic-offset:2 -*-
|
||||
### BEGIN INIT INFO
|
||||
# Provides: freeswitch
|
||||
# Required-Start: $network $remote_fs $local_fs postgresql
|
||||
# Required-Stop: $network $remote_fs $local_fs postgresql
|
||||
# Should-Start: mysql memcached mongodb
|
||||
# Should-Stop: mysql memcached mongodb
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: FreeSWITCH Softswitch
|
||||
# Description: FreeSWITCH Softswitch
|
||||
### END INIT INFO
|
||||
|
||||
# Author: Travis Cross <tc@traviscross.com>
|
||||
|
||||
PATH=/sbin:/usr/sbin:/bin:/usr/bin
|
||||
DESC=freeswitch
|
||||
NAME=freeswitch
|
||||
DAEMON=/usr/bin/freeswitch
|
||||
USER=www-data
|
||||
DAEMON_ARGS="-u $USER -ncwait"
|
||||
CONFDIR=/etc/$NAME
|
||||
RUNDIR=/var/run/$NAME
|
||||
PIDFILE=$RUNDIR/$NAME.pid
|
||||
SCRIPTNAME=/etc/init.d/$NAME
|
||||
WORKDIR=/var/log/$NAME
|
||||
|
||||
[ -x $DAEMON ] || exit 0
|
||||
[ -r /etc/default/$NAME ] && . /etc/default/$NAME
|
||||
. /lib/init/vars.sh
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
do_start() {
|
||||
if ! [ -f $CONFDIR/freeswitch.xml ]; then
|
||||
echo "$NAME is not configured so not starting.">&2
|
||||
echo "Please add configuration under /etc/freeswitch">&2
|
||||
echo "e.g. Install freeswitch-conf-vanilla, then:">&2
|
||||
echo "cp -a /usr/share/freeswitch/conf/vanilla /etc/freeswitch">&2
|
||||
return 3
|
||||
fi
|
||||
|
||||
# Directory in /var/run may disappear on reboot (e.g. when tmpfs used for /var/run).
|
||||
mkdir -p $RUNDIR
|
||||
chown -R $USER: $RUNDIR
|
||||
chmod -R ug=rwX,o= $RUNDIR
|
||||
|
||||
start-stop-daemon --start --quiet \
|
||||
--pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \
|
||||
--test > /dev/null \
|
||||
|| return 1
|
||||
ulimit -s 240
|
||||
start-stop-daemon --start --quiet \
|
||||
--pidfile $PIDFILE --exec $DAEMON --name $NAME --user $USER \
|
||||
--chdir $WORKDIR -- $DAEMON_ARGS $DAEMON_OPTS \
|
||||
|| return 2
|
||||
return 0
|
||||
}
|
||||
|
||||
stop_fs() {
|
||||
start-stop-daemon --stop --quiet \
|
||||
--pidfile $PIDFILE --name $NAME --user $USER \
|
||||
--retry=TERM/30/KILL/5
|
||||
}
|
||||
|
||||
stop_fs_children() {
|
||||
start-stop-daemon --stop --quiet \
|
||||
--exec $DAEMON \
|
||||
--oknodo --retry=0/30/KILL/5
|
||||
}
|
||||
|
||||
do_stop() {
|
||||
stop_fs
|
||||
RETVAL="$?"
|
||||
[ "$RETVAL" -eq 2 ] && return 2
|
||||
stop_fs_children
|
||||
[ "$?" -eq 2 ] && return 2
|
||||
rm -f $PIDFILE
|
||||
return "$RETVAL"
|
||||
}
|
||||
|
||||
do_reload() {
|
||||
start-stop-daemon --stop --quiet \
|
||||
--pidfile $PIDFILE --name $NAME --user $USER \
|
||||
--signal HUP
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Starting $DESC " "$NAME"
|
||||
do_start
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
stop)
|
||||
[ "$VERBOSE" != no ] && log_daemon_msg "Stopping $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1) [ "$VERBOSE" != no ] && log_end_msg 0 ;;
|
||||
2) [ "$VERBOSE" != no ] && log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
status)
|
||||
status_of_proc "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
reload|force-reload)
|
||||
log_daemon_msg "Reloading $DESC" "$NAME"
|
||||
do_reload
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart)
|
||||
log_daemon_msg "Restarting $DESC" "$NAME"
|
||||
do_stop
|
||||
case "$?" in
|
||||
0|1)
|
||||
do_start
|
||||
case "$?" in
|
||||
0) log_end_msg 0 ;;
|
||||
1|*) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
*) log_end_msg 1 ;;
|
||||
esac
|
||||
;;
|
||||
*)
|
||||
echo "Usage: $SCRIPTNAME {start|stop|status|restart|force-reload}" >&2
|
||||
exit 3
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
Reference in New Issue
Block a user