1. JustinPizzle's Avatar
    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 need
    sendsms 55555555 "hey"
    to run, then wait for it to send and succeed in sending the message, and then run the script again.
    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
    2009-08-03 08:35 PM
  2. defmute's Avatar
    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
    2009-08-03 10:18 PM
  3. JustinPizzle's Avatar
    Well that's almost no help...
    2009-08-04 01:42 AM
  4. boxxa's Avatar
    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
    2009-08-06 04:12 PM
  5. JustinPizzle's Avatar
    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; 2009-08-06 at 10:24 PM. Reason: Automerged Doublepost
    If i helped you, clicking thanks would be nice
    2009-08-06 10:24 PM
  6. boxxa's Avatar
    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****
    Ya not able to test it on a phone but upload a text file named sms_test.sh or whatever with that in there and then go into your terminal and type:

    chmoh +x sms_test.sh

    After that, try to run it: ./sms_test.sh

    No idea if it will work. In theory tho it should.
    2009-08-06 10:31 PM
  7. JustinPizzle's Avatar
    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; 2009-08-07 at 04:34 AM. Reason: Automerged Doublepost
    If i helped you, clicking thanks would be nice
    2009-08-07 04:34 AM
  8. boxxa's Avatar
    Take out the & after the sendsms command and see what the output is. Do u have the sendsms package installed from cydia?
    2009-08-07 05:40 AM
  9. JustinPizzle's Avatar
    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 go
    If i helped you, clicking thanks would be nice
    2009-08-07 05:59 AM
  10. boxxa's Avatar
    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.
    2009-08-07 03:29 PM
  11. JustinPizzle's Avatar
    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 sent
    If i helped you, clicking thanks would be nice
    2009-08-07 08:04 PM
  12. elbeasto's Avatar
    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.
    2009-08-10 02:33 PM
  13. boxxa's Avatar
    Ya its probably flooding the SMS command and dropping it.

    Try this version:

    #!/bin/bash
    COUNTER=0
    while [ -lt 10 ]; do
    sendsms 5555555555 "hey"
    sleep 6
    let COUNTER=COUNTER+1
    done
    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.
    2009-08-10 03:34 PM
  14. elbeasto's Avatar
    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.
    2009-08-11 05:37 AM
  15. boxxa's Avatar
    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
    2009-08-11 06:40 PM
LINK TO POST COPIED TO CLIPBOARD