--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+un...@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
---
You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.
This is great for reference.
Thanks for sharing your solution.
--
Nilesh Vaghela
ElectroMech Corporation
302, New York Plaza, Opp. chief Justice Bunglow
Bodakdev, Ahmedabad - 380054
www.electromech.info
fb.com/electromechcorp
Hi friends.
This is my script to check ping status and if not, then it will give command to run wvdial.
root@site01:~/script1# vim modem.sh
#!/bin/bash
HOSTS="google.com"
COUNT=4
for myHost in $HOSTS
do
count=$ (ping -c $COUNT $myHost | grep 'received' | awk -F',' '{ print $2 }' | awk
if [$count -eq 0]; then
wvdial
fi
done
By root user,
root@site01:~/script1# crontab -e
5 * * * * /bin/sh ~/script1/modem.sh
But it not works. whats the problem?
nc -vzw1 google.com 80 || wvdial
Dear Friends,Mr. Tejas, It has an error. I cant solve it

if i use script, below this error:
root@site01:~/script1# cat modem.sh
#!/bin/bash
HOSTS="8.8.8.8"
COUNT=4
for myHost in $HOSTS
do
pcount=$(ping -c $COUNT $HOSTS | grep 'received' | awk -F',' '{ print $2 }' | awk -F" " '{print $1}')
if [$pcount -eq 0]; then
wvdial
fi
done
root@site01:~/script1# sh modem.shIf i use this below, it's ok. but don't know why it's not working. Now I am using this script.
modem.sh: 7: modem.sh: [4: not found
root@site01:~/script1# sh wvdial.sh
Connection to google.com 80 port [tcp/http] succeeded!
root@site01:~/script1# crontab -l
5 * * * * /bin/sh ~/script1/wvdial.sh
root@site01:/var/log# grep cron /var/log/syslog
Jan 19 08:15:21 site01 anacron[1229]: Job `cron.daily' terminated (exit status: 1) (mailing output)
Jan 19 08:15:21 site01 anacron[1229]: Can't find sendmail at /usr/sbin/sendmail, not mailing output
Jan 19 08:15:21 site01 anacron[1229]: Normal exit (1 job run)
Jan 19 08:17:01 site01 CRON[4592]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 09:17:01 site01 CRON[4768]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 10:17:01 site01 CRON[4944]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 11:17:01 site01 CRON[5118]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 12:17:01 site01 CRON[5295]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 12:44:45 site01 cron[5943]: (CRON) INFO (pidfile fd = 3)
Jan 19 12:44:45 site01 cron[5944]: (CRON) STARTUP (fork ok)
Jan 19 12:44:45 site01 cron[5944]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 19 12:44:56 site01 crontab[5945]: (cairns) BEGIN EDIT (cairns)
Jan 19 12:45:00 site01 crontab[5945]: (cairns) END EDIT (cairns)
Jan 19 12:45:20 site01 crontab[5973]: (root) LIST (root)
Jan 19 13:17:01 site01 CRON[6300]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 14:17:01 site01 CRON[6483]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 15:17:01 site01 CRON[6667]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 16:17:01 site01 CRON[6852]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 16:54:20 site01 cron[6990]: (CRON) INFO (pidfile fd = 3)
Jan 19 16:54:20 site01 cron[6991]: (CRON) STARTUP (fork ok)
Jan 19 16:54:20 site01 cron[6991]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 19 17:07:02 site01 crontab[9781]: (root) BEGIN EDIT (root)
Jan 19 17:07:32 site01 crontab[9781]: (root) REPLACE (root)
Jan 19 17:07:32 site01 crontab[9781]: (root) END EDIT (root)
Jan 19 17:07:37 site01 crontab[9915]: (root) LIST (root)
Jan 19 17:07:54 site01 cron[9931]: (CRON) INFO (pidfile fd = 3)
Jan 19 17:07:54 site01 cron[9932]: (CRON) STARTUP (fork ok)
Jan 19 17:07:54 site01 cron[9932]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 19 17:08:06 site01 cron[10060]: (CRON) INFO (pidfile fd = 3)
Jan 19 17:08:06 site01 cron[10061]: (CRON) STARTUP (fork ok)
Jan 19 17:08:06 site01 cron[10061]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
Jan 19 17:17:01 site01 CRON[12272]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 17:27:01 site01 crontab[15036]: (root) LIST (root)
Jan 19 18:17:01 site01 CRON[18318]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 18:56:25 site01 crontab[19244]: (cairns) LIST (cairns)
Jan 19 18:56:47 site01 crontab[19256]: (root) LIST (root)
Jan 19 19:17:01 site01 CRON[19338]: (root) CMD ( cd / && run-parts --report /etc/cron.hourly)
Jan 19 19:36:02 site01 crontab[23641]: (root) LIST (root)
Jan 19 19:51:40 site01 cron[27571]: (CRON) INFO (pidfile fd = 3)
Jan 19 19:51:40 site01 cron[27572]: (CRON) STARTUP (fork ok)
Jan 19 19:51:40 site01 cron[27572]: (CRON) INFO (Skipping @reboot jobs -- not system startup)
if i use script, below this error:
root@site01:~/script1# cat modem.sh
#!/bin/bash
HOSTS="8.8.8.8"pcount=$(ping -c $COUNT $HOSTS | grep 'received' | awk -F',' '{ print $2 }' | awk -F" " '{print $1}')
COUNT=4
for myHost in $HOSTS
do
if [$pcount -eq 0]; then
If i use this below, it's ok. but don't know why it's not working. Now I am using this script.root@site01:~/script1# sh modem.shwvdial
fi
done
modem.sh: 7: modem.sh: [4: not found
root@site01:~/script1# cat wvdial.sh
root@site01:~/script1# sh wvdial.sh
Connection to google.com 80 port [tcp/http] succeeded!
It's working .root@site1:~/script1# sudo crontab -e
*/5 * * * * /bin/nc -vzw1 google.com 80 || /usr/bin/wvdial
Manually I give commandroot@site1# eject /dev/sr1then the script runs and it works. so how to permanently solve this issue ?
nc -nvzw1 8.8.8.8 53 || { eject /dev/sr1 && wdial; }
#!/bin/bash hosts="8.8.8.8" count=4 for ip in $hosts do pcount=$(ping -c $count $ip | awk '/[0-9] received,/{ print $4}' )
if [[ $pcount -eq 0 ]]; then
eject /dev/sr1 && wvdial
fi
done
eject /dev/sr1 && wvdial after that ,it founds as:eject /dev/sr1 && wvdial
just wvdial command is enough.So, is it possible when I connects the modem, it detects automatically as a modem??
This tells the modem not to use CD mode when it's first plugged into a computer.Init1 = AT+ZOPRT=5 Init2 = AT+ZCDRUN=8
#!/bin/bash hosts="8.8.8.8" count=4 for ip in $hosts do pcount=$(ping -c $count $ip | awk '/[0-9] received,/{ print $4}' ) if [[ $pcount -eq 0 ]]; then
# if modem connected then do not eject (change modem ID)
lsusb | grep -q '19d2:0167 ZTE' || eject /dev/sr1
wvdial
fi
doneFirst remove usb-storage then modprobe usbserial
rmmod usb_storage modprobe usbserial
Edit /etc/wvdial.conf :
[Dialer Defaults] Modem = /dev/ttyUSB0 Modem Type = Analog Modem ISDN = 0 Init1 = AT+ZOPRT=5 Init2 = AT+ZCDRUN=8
Run wvdial, it should use those commands and fail to connect.
After that I edit wvdial.conf file
root@site01:~/script1# cat /etc/wvdial.conf
[Dialer Defaults]
Init1 = ATZ
#Init3 = AT+Z0PRT=5
#Init4 = AT+ZCDRUN=8
Stupid Mode = 1
Dial Attempts = 3
Password = { }
Init7 = AT+CGEQREQ=1,4,64,640,64,640
Phone = *99#
APN = gprs.qtel
Modem Type = Analog Modem
Baud = 9600
Modem = /dev/ttyUSB2
; Init1 = AT+ZCDRUN=9
ISDN = 0
Username = { }
Init2 = ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
Auto Reconnect = on
Init6 = AT+CGEQMIN=1,4,64,640,64,640
then when I unplugged the device and again plugged it.then it detects :
root@site01:~/script1# lsusb
Bus 002 Device 007: ID 19d2:0167 ZTE WCDMA Technologies MSM
my cron file is:
root@site01:~/script1# crontab -l
*/5 * * * * /bin/nc -vzw1 google.com 80 || /usr/bin/wvdial
Thanks for your help.
I tried your script also. but found error:
cairns@site01:~/script1$ sh modem.sh
connect: Network is unreachable
modem.sh: 7: modem.sh: [[: not found
[1]+ Done gedit modem.sh
Hi small suggestion.
Instead [[ $pcount -eq 0 ]] try to use [ -z $pcount ]
Might help you.
As such -eq expect some comparison value and if value not found will give error.
Thanks and regards.
--
Nilesh Vaghela
ElectroMech Corporation
302, New York Plaza, Opp. chief Justice Bunglow
Bodakdev, Ahmedabad - 380054
www.electromech.info
fb.com/electromechcorp
Hey friends,Finally I have found out the solution!!!The scene was something like this - whenever I attached the dongle, it was taken as cd-rom (Zero-CD mode) attached at /dev/sr0 or sr1.This was due to Windows drivers on that part of dongle.I ejected /dev/sr0 and wow!! productid changed from usb to modem automatically!!!Rest of the things I handle with the help of Sakis3G.
On Wed, Jan 15, 2014 at 12:33 PM, Sandeep Dange <dange....@gmail.com> wrote:
I had been through many articles about this. but found no specifics with airtel 4g dongle.
problem is whenever i connect it detects it as mass storage device. despite all the mobile settings
and usb-mode-switch i found no luck on it.
could any one got succeded plz share your "how-to" or any links you would have referred.
thanks,
sandeep
--
Please read http://www.catb.org/~esr/faqs/smart-questions.html before posting.
You received this message because you are subscribed to the "Vibrant GNU/Linux User Group".
To stop receiving emails from this group, mail to VGLUG+unsubscribe@googlegroups.com
To post to this group, send email to VG...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/VGLUG
---
You received this message because you are subscribed to the Google Groups "VGLUG" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vglug+unsubscribe@googlegroups.com.