Reply
Thread Tools
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#41
Originally Posted by Sonny_Jim View Post
Notice that you don't need to write/read a tmpfile, you can just use a backtick. But for some really annoying reason it still isn't working,

p.s You didn't just copy and paste my tar command? I think you might have picked up sms-manager with the wildcard if you did.
No, I didn't copy-paste it.. btw, did you mean to put the 'j' option in the tar command?
 
Posts: 200 | Thanked: 300 times | Joined on Nov 2009 @ The Netherlands
#42
Originally Posted by AlexV12 View Post
perhaps ik would be good to combine your programs? sounds like you could help each other allot!
I will post my code soon, it needs some documentation & cleanup.
 
Posts: 45 | Thanked: 17 times | Joined on Mar 2010
#43
Originally Posted by boxhead View Post
did you mean to put the 'j' option in the tar command?
I meant to put the j in, but forgot to change the file extensions to tar.bz2. You should nearly always use bz2 as it's smaller.
 
Posts: 56 | Thanked: 31 times | Joined on Jul 2008 @ Austria
#44
Originally Posted by boxhead View Post
What does 'export' do?
Usually, all your shell variables are known only to the current shell.

If you want the actual _programs_ you start to also get them, you have to export them to the (current process', that is, the shell's) environment first. Once you start another program, it will receive a copy of your environment and thus have a copy of the variable (its name and its value) in there, too.

Actually, I don't know why it makes things better in this situation, because the script uses the shell to expand all the variables to their values anyway - so what use it exporting them if one is already passing them as arguments?

On a slightly off-topic note, the way UNIX processes work is like this:

As far as the kernel is concerned a process is a collection of: process ID, command line arguments, environment, current working directory, process running status, user ID, standard input, standard output, standard error, open files, memory blocks, disk image it was loaded from, other stuff we don't care about.

The first process there is is called "init". It always has PID (process ID) 1.

This "init" process doesn't want to do all the work on its own so it will clone itself (the function is called "fork"), and instruct the clone to do the dirty work. The only thing it does is to wait until the clones die and if so, launch new ones.

This "fork"ing will copy the entire "process" information as-is except for the process ID (will get a new one). This includes the environment variables and that's why they are called "environment" variables :-)

Clones (or more correctly: Processes) can instruct the kernel to load another image, at which point the memory blocks of ITSELF will be filled by loading the new disk image (and the process' command line arguments be updated). Then it executes the function "main" in the newly overwritten memory blocks (the function to do all this is called "exec"). This will not touch environment variables (would usually make no sense).

So the way you can use this is to set some environment variables as early as possible (using "export" in shell or "putenv" in C) and all the other programs started by you (or your children) after that will see them (or at least see copies of them), whether they want to or not (and that later point is the principal difference to arguments).

Note that they can change their copies of the environment variables but they cannot affect their parents (you probably couldn't make rules for your parents either ;-) )

Famous environment variables are
PATH the search path for executables.
HOME the directory where your user data is (i.e. the "home directory").
DISPLAY the display (roughly computer monitor) to display programs on
JAVA_HOME which java VM to use, if anyone wants to use a java VM.

Last edited by dannym; 2010-08-21 at 14:15.
 

The Following User Says Thank You to dannym For This Useful Post:
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#45
Thanks for such a thorough explanation, danny. I was wondering why some upstart scripts were using "exec" instead of just running their external processes within script...endscript and now it makes sense.

What doesn't make sense is how no one has reported success for either the original script or the modified one with added "exports" (which shouldn't even doing anything). I've installed it on two different n900s using the same installation steps and it works flawlessly. Can anyone out there confirm that the script works for them?
 
Posts: 56 | Thanked: 31 times | Joined on Jul 2008 @ Austria
#46
Originally Posted by Sonny_Jim View Post
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?
Hi...

You have transferred a file (probably from a Windows computer) containing a carriage return (or 30) to the UNIX platform and while Windows ignores it, UNIX actually knows such arcane controls.
Therefore, it actually gives the carriage return to the started process (if it can in fact locate the disk image "foobar<carriage return>".
One can tell by the wonderfully arcane way it overwrote the "line 22" by "<go back to the beginning of the line>: not found". Cute :-)

No, on a more serious note:
Windows (and DOS) text files are like this:
blahblah<carriage return><line feed>
blahblahblah<carriage return><line feed>

UNIX text files are like this:
blahblah<line feed>
blahblahblah<line feed>

Use "dos2unix" or your favourite hex editor (or a decent programmer's text editor) to get rid of the extra carriage returns.

If you are on UNIX, remove them by:
tr -d "\r" <XX >XXX

Last edited by dannym; 2010-08-21 at 20:09.
 
Posts: 62 | Thanked: 6 times | Joined on Jun 2010 @ Poland
#47
Hello!
I have a problem. I send sms with alert code, n900 try to connect to gps. When it connected i don't get any sms and i don't know why. I think i make banana script good.

export VALID_IMSI=2600196032***** # this is your own IMSI
export SEND_TEXT_INTERVAL=120.0 # how often (sec) to send SMS
export HOME_PHONE=601123456 # designated phone number to send SMS and phone calls
export TIME_WAIT_TO_CALL=60 # time to wait (sec) after invalid SIM card detected before making phone call
export ALERT_CODE="666" # SMS code used to activate alert mode
The phone numer must be with quotation marks ("") ? Or with country code (+48).
Help me please.
Is there any way to send email also??

Sorry for my english. Waiting for replay.
__________________
Maemo Meego Maego!
 
Posts: 26 | Thanked: 11 times | Joined on Nov 2009
#48
Originally Posted by knypek3 View Post
Hello!
I have a problem. I send sms with alert code, n900 try to connect to gps. When it connected i don't get any sms and i don't know why. I think i make banana script good.



The phone numer must be with quotation marks ("") ? Or with country code (+48).
Help me please.
Is there any way to send email also??

Sorry for my english. Waiting for replay.
I thought there might be trouble with non-US phone number formatting. You could try this to test number formatting:

Change HOME_PHONE to 0048601XXXXXX
Change VALID_IMSI to an invalid one
Reboot

If the 0048 prefix works, we can make a small change to the python script to get alert-code SMS working too.

Is there any way to send email also??
There's no email function yet.
 
Banned | Posts: 695 | Thanked: 308 times | Joined on Apr 2011 @ originally pakistan ,now in china
#49
is there any else phone tracker app in case n900 stolen? simple one ;p
its a bit techy and i dont think so i am capable of doing it..
so any mighty job will be really appreciated.. thanks
 
Saturn's Avatar
Posts: 1,648 | Thanked: 2,122 times | Joined on Mar 2007 @ UNKLE's Never Never Land
#50
Originally Posted by prankster View Post
is there any else phone tracker app in case n900 stolen? simple one ;p
its a bit techy and i dont think so i am capable of doing it..
so any mighty job will be really appreciated.. thanks
check if this works for you http://wiki.maemo.org/SMSCON
 

The Following User Says Thank You to Saturn For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 22:01.