#!/bin/sh

VENDOR_PATH=$1

echo `date`"++PPPD: start" >> $VENDOR_PATH/pppd_retval.log

shift
pppd $1 $2 $3 $4 $5 $6 $7

PPPD_RETVAL=$?
echo "PPPD: Retval = $PPPD_RETVAL"
echo `date`"--PPPD: Retval = $PPPD_RETVAL" >> $VENDOR_PATH/pppd_retval.log

if [ $PPPD_RETVAL != 0 ] && [ $PPPD_RETVAL != 1 ] && [ $PPPD_RETVAL != 5 ] && [ $PPPD_RETVAL != 6 ]; then
        echo "Modem Err $PPPD_RETVAL"
        $VENDOR_PATH/gsm_MSQ "*AT+cfun=1,1"
fi
