-
08-03-2009, 12:35 PM #1iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
how do i run a script in terminal.
how can i execute scrips to be run in terminal. (on the iphone)
im using the sendsms code line, and im having this competition with a buddy of mine
irrelevent sorry.
i needto run, then wait for it to send and succeed in sending the message, and then run the script again.sendsms 55555555 "hey"
preferably stop at around 20 or 30.
so i dont get stuck in a loop.
anyone know how i can do this?
any help is appreciated
btw wer having a competition as to who can send the most texts in half an hour
and at no time did anyone say anything about automated sending
-
08-03-2009, 02:18 PM #2My iPhone is a Part of Me
- Join Date
- Oct 2007
- Location
- Colorado
- Posts
- 569
- Thanks
- 10
- Thanked 53 Times in 41 Posts
Your title question is not the same as the question in your message. So I will only answer the title quesion:
chmod 755 program
./program
-
08-03-2009, 05:42 PM #3iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
Well that's almost no help...
-
08-06-2009, 08:12 AM #4Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
Since the iPhone uses the Bourne Again SHell just look the command in a .sh script. Chmod it to +x and run ./script.sh
#!/bin/bash
i="0"
while [ -lt 20 ]
do
sendsms 55555555 "hey" &
i=$[+1]
done
-
The Following User Says Thank You to boxxa For This Useful Post:
JustinPizzle (08-06-2009)
-
08-06-2009, 02:24 PM #5iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
Ok so I make
a spript file named whatever.sh
containing what you quoted
and then just put it on the phone and run it with terminal?
I'm on the iPhone. Sorry about the spelling****Last edited by JustinPizzle; 08-06-2009 at 02:24 PM. Reason: Automerged Doublepost
If i helped you, clicking thanks would be nice
-
08-06-2009, 02:31 PM #6Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
-
08-06-2009, 08:34 PM #7iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
haha im going to try it right now.
THANKS!
ok well the .sh file runs. but nothing happens.
it just returns like it was successful and then theres nothing...
and yes, i did replace the 55555555 number with my own.Last edited by JustinPizzle; 08-06-2009 at 08:34 PM. Reason: Automerged Doublepost
If i helped you, clicking thanks would be nice
-
08-06-2009, 09:40 PM #8Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
Take out the & after the sendsms command and see what the output is. Do u have the sendsms package installed from cydia?
-
08-06-2009, 09:59 PM #9iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
how should i go about making the .sh file.
ive tried with text edit and apple scrip editor
and removing the & still is a no goIf i helped you, clicking thanks would be nice
-
08-07-2009, 07:29 AM #10Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
Use vi or make it on your computer and upload it to the phone. Its just a text file.
if you run sendsms "5555555555" "Test" from the terminal does it work? Make sure you get sendsms working properly before you worry about the script.
-
08-07-2009, 12:04 PM #11iPhone? More like MyPhone
- Join Date
- Aug 2008
- Location
- California
- Posts
- 212
- Thanks
- 13
- Thanked 16 Times in 16 Posts
yup. it works fine without the script.
i make it with text edit. save as "sh.rtf"
then remove the "rtf"
and upload it onto the phone.
then all the commands you said, down to the letter
it runs, no errors but no sms is sentIf i helped you, clicking thanks would be nice
-
08-10-2009, 06:33 AM #12
Well I am a Java programmer not a scriptor but you can solve the problem in a similar fashion. First thing I would do is eliminate the possibility of it being a communication problem with sms and instead of the sms command put in 'echo blah blah' and see if blah blah prints. If not then you know you arent ever going in the loop.
Secondly why do you need to wait for it to finish sending before you try sending again anyway? I mean realistically you could make it an infinite loop that is stopped by some command. That is clearly not the 'best practices' approach however you are trying to win a bet not a nobel prize lol. My guess is that by sending them continuously one after another with no delay sms will error out whatever it cant process but it wont matter because while it is giving you error messages it is still processing the script. One thing I would test before doing something that crazy though is put a 1 sec delay in between them and see if accepts them. I dont know how it works but perhaps the app will queue what you are trying to send and if that is the case you will most likely overflow your buffer and crash your phone altogether if you have no delay and continuously do it for 20-30 minutes. So I would test like 10 seconds with 1 sec delays in between and see if you get 3 messages or 10.
-
08-10-2009, 07:34 AM #13Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
Ya its probably flooding the SMS command and dropping it.
Try this version:
it will run the script and wait 6 seconds between loops and go through it 10 times so it will send out 10 messages in 1 minute.#!/bin/bash
COUNTER=0
while [ -lt 10 ]; do
sendsms 5555555555 "hey"
sleep 6
let COUNTER=COUNTER+1
done
-
08-10-2009, 09:37 PM #14
again I am no scriptor but I thought Id point out in the first script there is no semi colon after the while statement where as in the second one there is. Perhaps the first script was not executing because of a syntax error? Also the keyword let is missing from the first script. Again I dont know for sure but I am just comparing the 2 different scripts.
-
08-11-2009, 10:40 AM #15Livin the iPhone Life
- Join Date
- Aug 2008
- Location
- New York
- Posts
- 1,014
- Thanks
- 3
- Thanked 77 Times in 62 Posts
I typed both of those from memory. Here is a working script that I tested on a linux box. THe only difference between this one and the one I tested was that I just echoed a command instead of running sendsms since my server doesnt have a sendsms command.
#!/bin/bash
COUNTER=0
while [ -lt 10 ]; do
sendsms "5555555555" "hey"
sleep 5
let COUNTER=COUNTER+1
done



LinkBack URL
About LinkBacks
Reply With Quote
