asterisk-1.8.x: fix init script
Signed-off-by: Jiri Slachta <slachta@cesnet.cz>
This commit is contained in:
parent
1d2aadf8f8
commit
4dc7158111
1 changed files with 26 additions and 12 deletions
|
@ -1,21 +1,35 @@
|
|||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2008 OpenWrt.org
|
||||
START=50
|
||||
# Copyright (C) 2013 OpenWrt.org
|
||||
|
||||
. /lib/functions/service.sh
|
||||
|
||||
START=99
|
||||
APP=asterisk
|
||||
OPTIONS=
|
||||
DEST=
|
||||
DEFAULT=$DEST/etc/default/asterisk
|
||||
OPTIONS=""
|
||||
DEFAULT=$DEST/etc/default/$APP
|
||||
BIN_FILE=$DEST/usr/sbin/$APP
|
||||
PID_FILE=$DEST/var/run/$APP/$APP.pid
|
||||
|
||||
start() {
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d $DEST/var/run/asterisk ] || mkdir -p $DEST/var/run/asterisk
|
||||
[ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk
|
||||
[ -d $DEST/var/spool/asterisk ] || mkdir -p $DEST/var/spool/asterisk
|
||||
[ -d /var/spool/asterisk ] || mkdir -p /var/spool/asterisk
|
||||
[ -h $DEST/usr/lib/asterisk/astdb ] || ln -sf /var/spool/asterisk/astdb $DEST/usr/lib/asterisk/astdb
|
||||
$DEST/usr/sbin/asterisk $OPTIONS
|
||||
[ -f $DEFAULT ] && . $DEFAULT
|
||||
[ -d $DEST/var/run/asterisk ] || mkdir -p $DEST/var/run/asterisk
|
||||
[ -d $DEST/var/log/asterisk ] || mkdir -p $DEST/var/log/asterisk
|
||||
[ -d $DEST/var/spool/asterisk ] || mkdir -p $DEST/var/spool/asterisk
|
||||
[ -d $DEST/var/lib ] || mkdir -p $DEST/var/lib
|
||||
[ -h $DEST/var/lib/asterisk ] || ln -s /usr/lib/asterisk /var/lib/asterisk
|
||||
[ -d $DEST/var/lib/asterisk/keys ] || mkdir -p $DEST/var/lib/asterisk/keys
|
||||
|
||||
SERVICE_PID_FILE="/var/run/asterisk/asterisk.pid" \
|
||||
service_start $BIN_FILE $OPTIONS
|
||||
}
|
||||
|
||||
stop() {
|
||||
[ -f $DEST/var/run/asterisk/asterisk.pid ] && kill $(cat $DEST/var/run/asterisk/asterisk.pid) >/dev/null 2>&1
|
||||
SERVICE_PID_FILE="/var/run/asterisk/asterisk.pid" \
|
||||
service_stop $BIN_FILE
|
||||
}
|
||||
|
||||
reload() {
|
||||
SERVICE_PID_FILE="/var/run/asterisk/asterisk.pid" \
|
||||
service_reload $BIN_FILE
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue