it is not running, run the wvdial command inbackground. In addition, it generates a log file named check-hotspot.log withthe following format: date/time, RX bytes, TX bytes, status, where statusmeans: 0 process restarted, 1 modem working.Here is the crontab line I am using to run the watchdogSo, checking the log file it is possible to know when themodem dropped and was restarted. Below you can see the code.#!/bin/bash#Watch Dog for Host Spot device#Author: carlosrl@gmail.com#Nov/09/15 #Version 1.0#Description: The watchdog will check the behavior of modem connected topre-defined interface and #will call wvdial tool if the refered modem is not communicating. This will workas a "restart modem process"####Init variblesiTX=0iRX=0iRXTX=""fRX=0fTX=0fRXTX=""STATUS=0LOG_DIR=/var/logLOGFILE="/var/log/check-hotspot.log"DEV="eth0"#Run as root, of course.if[ "$UID" -ne 0 ]; then echo "Must be root to run thisscript." exit $E_NOTROOTfi#-- Gathering data from interfaceif [-n "$1" ]; then#Test whether command-line argument is present (non-empty). dev=$1else dev=$DEV # Default, if not specified oncommand-line.fi#-- Verify that interface is streaming dataiRXTX=`ifconfig$dev | awk '/RX bytes/ { $2=substr($2,7); $6=substr($6,7); printf("%i %i", $2, $6) }' `iRX=`echo$iRXTX | cut -d' ' -f1`iTX=`echo$iRXTX | cut -d' ' -f2`#-- Gathering data from log fileFTIME=`date+%m/%d/%y-%H:%M:%S`if[ -e "$LOGFILE" ]; then #echo "file $LOGFILE found" fRXTX=$(tail -n 1 $LOGFILE) #echo $fRXTX if[ -n "$fRXTX" ]; then fRX=`echo $fRXTX | cut -d' ' -f2` fTX=`echo $fRXTX | cut -d' ' -f3` STATUS=`echo $fRXTX | cut -d' ' -f4` fielse # create a new log file echo "$FTIME $iRXTX 1" > $LOGFILE exit 8fi # check if modem process is runningproc=`ps axl | grep -E "pppd" |grep -E "modem" | grep -E "wvdial"`if[ -n "$proc" ]; then # hotspot is running. Just update log file echo "$FTIME $iRXTX 1" >>$LOGFILE exit 4else # modem process not running. Lets restartit. echo "$FTIME $iRXTX 0" >>$LOGFILE /usr/bin/wvdial & exit 10fi driver= nl80211 6. Reboot Finally, reboot the Raspberry Pi. After thereboot, run the ifconfig command and verify that the interfaces have thecorrect IP and are transmitting the data. Below is my ifconfig:See that ppp0 interface (3G modem) is receiving andsending data. The same goes for wlan0 interface, which means that data isflowing to / from the Internet (external network) to / from devices connectedto the hotspot (internal network).To make a check, connect a laptop, tablet or smartphone and try to connect tothe hotspot.The figure below I connected a smartphone to the hotspot created here, ieHotPi.The figure shows the final result achieved with theRaspberry Pi connected to the monitor configuration. The range of thehotspot signal provided by RT530 wireless modem, was around 30m which is quitereasonable for use in a house.For use on a daily basis, you do not need mouse, keyboard or a monitor device attachedto RPi. You will find all the configuration files used in this project ingithub here. 7. ReferencesIn this project, I searched someblogs and documents found on the internet. Among the many found, I list here the ones used as referencehttp://elinux.org/RPI-Wireless-Hotspothttps://www.thefanclub.co.za/how-to/how-setup-usb-3g-modem-raspberry-pi-using-usbmodeswitch-and-wvdialhttp://www.revsys.com/writings/quicktips/nat.html