It is currently Mon May 21, 2018 6:41 pm

Automatic pause of a shells script

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon Nov 18, 2013 4:07 am   

Joined: Mon Nov 18, 2013 3:56 am
Posts: 1
Hi all!

I'm new here and I am eager to learn bash.
I started learning it for a sms platform that I am building. It is sending sms for around 1000 people in rural Mozambique (poor coverage in rural areas)
I have a shell script that executes the following:

# My first script

echo "Page 1"

gsmsendsms -d /dev/ttyUSB0 -b 19200 -r 86XXXXXXX "Text of SMS message 1"
gsmsendsms -d /dev/ttyUSB0 -b 19200 -r 84XXXXXXX "Text of SMS message 2"
echo "Page 22
gsmsendsms -d /dev/ttyUSB0 -b 19200 -r 82XXXXXXX "Text of SMS message"

My problem is that the carrier that I am using (can't change it at the moment) has a limit of 50 pending messages per user. So if more than 50 people have no network, or have the cellphone turned off the sms's will stop going!
I have no way to know which numbers didn't receive as the error message in the shell is just:

gsmsendsms[ERROR]: ME/TA error 'unknown error' (code 500)

However, if I wait a while the things will start going again.
My idea was to tell the bash script to stop and wait like 30 mins in case that error occurs, it would be even great if it would print the last line of the script!. Is it possible? Or at least tell the script to every once in a while pause for a certain amount of time (even if I have to copy paste that command all over the file)

Thank you all!!


 PostPosted: Tue Nov 26, 2013 7:13 pm   
User avatar

Joined: Wed Jun 08, 2011 8:27 am
Posts: 189
Location: outer Shpongolia
If I understand your issue correctly, you just need to sleep(0) whenever an error occurs,
that is you have to wait a while from a loop when gsmsendsms(1) has an exit status of 1.

Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 5 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group