maemo.org - Talk

maemo.org - Talk (https://talk.maemo.org/index.php)
-   Development (https://talk.maemo.org/forumdisplay.php?f=13)
-   -   SMS-based stolen phone locator (https://talk.maemo.org/showthread.php?t=60516)

Sonny_Jim 2010-08-18 16:43

Re: SMS-based stolen phone locator
 
I'm having trouble with the banana script, it seems to never launch on boot?

I've not chmod'd, just put it into /etc/event.d, is there anything else I need to do apart from edit the top? Is there anyway to see debug upstart?

EDIT: Also, how about sending the cell tower info as well?

boxhead 2010-08-18 16:47

Re: SMS-based stolen phone locator
 
Try commenting out these lines:
start on started hildon-desktop
stop on starting shutdown
script
end script

Then run it from terminal. What output do you get?

Sonny_Jim 2010-08-18 16:58

Re: SMS-based stolen phone locator
 
Nokia-N900:/etc/event.d# sh banana
: not founde 2:
: not founde 5:
: not founde 6:
: not founde 9:
: not founde 17:
: not founde 22:
banana: line 26: syntax error: "done" unexpected (expecting "do")

I didn't do anything apart from download it from the 1st post, put it into event.d and edit the top of the file

EDIT: I think it needs bash?

boxhead 2010-08-18 17:05

Re: SMS-based stolen phone locator
 
did you copy over the sms files? also, maybe you're missing python runtime?

Sonny_Jim 2010-08-18 17:10

Re: SMS-based stolen phone locator
 
Nope, I can run the files just fine manually, it's just the upstart script. The one thing I did do was edit banana using vim for windows, so maybe it's screwing up the line endings or something. I'll try with a 'vanilla' banana and not edit it before copying it across.

EDIT: Nope, still not working. I hate to ask this but have you tried using the files from your zipfile? Are you sure that the zip program isn't doing something strange to the line endings?

boxhead 2010-08-18 17:16

Re: SMS-based stolen phone locator
 
fyi i wrote it using winscp's built-in text editor

EDIT: I tried downloading the zip file, copying banana using winscp, and editing it using winscp's editor and the python program still runs as it should.

Sonny_Jim 2010-08-18 17:44

Re: SMS-based stolen phone locator
 
I ended up having to format it like this to get it to work without errors:

export VALID_IMSI=
export SEND_TEXT_INTERVAL=120.0
export HOME_PHONE=
export TIME_WAIT_TO_CALL=60
export ALERT_CODE="XXXXXX"
touch /tmp/imsi
export imsiFile=/tmp/imsi
dbus-send --system --type=method_call --print-reply --dest=com.nokia.phone.SIM /com/nokia/phone/SIM Phone.Sim.get_imsi | grep string | cut -f 2 -d '"' > $imsiFile
while read line
do
imsiNum=$line
done < $imsiFile

if [ $imsiNum -ne $VALID_IMSI ]; then
python /usr/sbin/sms.py --sendinfo $HOME_PHONE $SEND_TEXT_INTERVAL $imsiNum $ALERT_CODE
python /usr/sbin/sms.py --listen 0 $SEND_TEXT_INTERVAL $imsiNum $ALERT_CODE &
sleep $TIME_WAIT_TO_CALL
run-standalone.sh dbus-send --system --type=method_call --print-reply --dest=com.nokia.csd.Call /com/nokia/csd/call com.nokia.csd.Call.CreateWith string:"$HOME_PHONE" uint32:0
else
python /usr/sbin/sms.py --listen 0 $SEND_TEXT_INTERVAL $imsiNum $ALERT_CODE &

boxhead 2010-08-18 17:53

Re: SMS-based stolen phone locator
 
What does 'export' do? Also, is it working with upstart now? If so, could you attach your file to the post so I can test it and update the zip. Thx.

Sonny_Jim 2010-08-18 17:55

Re: SMS-based stolen phone locator
 
You are asking me what 'export' does? Sheesh.

Ok, I'll sit down and have a go at doing it properly and then get back to you.

boxhead 2010-08-18 18:00

Re: SMS-based stolen phone locator
 
hah yeah.. as i mentioned, I'm new to sh scripting. I see that it makes the variables global, but I don't see how that fixes the script on your end.


All times are GMT. The time now is 11:21.

vBulletin® Version 3.8.8