Fix init.d script

This commit is contained in:
Dominic Grimm 2024-08-01 14:21:33 +02:00
parent 1f06c9f40f
commit e110ca0a0f

View file

@ -108,38 +108,38 @@ sudo cp ./t38modem /usr/local/bin
# /etc/init.d/t38modem # /etc/init.d/t38modem
export LD_LIBRARY_PATH=/usr/local/lib export LD_LIBRARY_PATH=/usr/local/lib
export PTLIBPLUGINDIR=/usr/local/lib/ptlib-x.y.z:/usr/local/lib/opal-x.y.z # Adjust lib vers> export PTLIBPLUGINDIR=/usr/local/lib/ptlib-x.y.z:/usr/local/lib/opal-x.y.z # Adjust lib versions!
case "$1" in case "$1" in
start) start)
. /etc/t38modem/config . /etc/t38modem/config
# defines # defines
# - T38MODEM_SIP_USERNAME # - T38MODEM_SIP_USERNAME
# - T38MODEM_SIP_PASSWORD # - T38MODEM_SIP_PASSWORD
# - T38MODEM_SIP_SERVER # - T38MODEM_SIP_SERVER
COMMAND="t38modem -u 'T38modem' --ptty +/dev/ttyT38-1 --sip-proxy '${T38MODE> COMMAND="t38modem -u 'T38modem' --ptty +/dev/ttyT38-1 --sip-proxy '${T38MODEM_SIP_USERNAME}:${T38MODEM_SIP_PASSWORD}@${T38MODEM_SIP_SERVER}' --sip-register '${T38MODEM_SIP_USERNAME}@${T38MODEM_SIP_SERVER},${T38MODEM_SIP_PASSWORD}' --sip-listen udp\$:5060 --route 't38:.*=sip:<dn>@${T38MODEM_SIP_SERVER}' --route 'sip:.*=t38:<dn>'"
exec $COMMAND > /dev/null 2>&1 & exec $COMMAND > /dev/null 2>&1 &
PID=$! PID=$!
echo "Starting t38modem with pid $PID (pidfile /run/t38modem.pid)" echo "Starting t38modem with pid $PID (pidfile /run/t38modem.pid)"
echo $PID > /run/t38modem.pid echo $PID > /run/t38modem.pid
;; ;;
stop) stop)
if [ ! -f "/run/t38modem.pid" ]; then if [ ! -f "/run/t38modem.pid" ]; then
echo "t38modem is not running! (/run/t38modem.pid does not exist)" echo "t38modem is not running! (/run/t38modem.pid does not exist)"
exit 1 exit 1
fi fi
echo -n "Stopping t38modem pid: " echo -n "Stopping t38modem pid: "
PID=`cat /run/t38modem.pid` PID=`cat /run/t38modem.pid`
kill -9 $PID kill -9 $PID
rm /run/t38modem.pid rm /run/t38modem.pid
echo "${PID} Done" echo "${PID} Done"
;; ;;
*) *)
echo "Usage: $0 {start|stop}" echo "Usage: $0 {start|stop}"
exit 1 exit 1
;; ;;
esac esac
exit 0 exit 0