[maemo-developers] auto-start application

From: Tony Green maemo at beermad.org.uk
Date: Sat May 17 13:16:22 EEST 2008
On Saturday 17 May 2008, maemo-developers-request at maemo.org wrote:

> Message: 7
> Date: Fri, 16 May 2008 10:33:52 -0400
> From: "Michael D. Boulanger" <mike at mbdatasystems.com>
> Subject: RE: auto-start application
> To: <maemo-developers at maemo.org>
> Message-ID: <000801c8b761$dd1300e0$973902a0$@com>
> Content-Type: text/plain;	charset="us-ascii"
> 
> I went ahead and installed 'gainroot' on the Nokia, and used vi to edit the
> following startup file:
> 
> /etc/osso-af-init/real-af-base-apps
> 
> At the end of the file, I added a line to run the application:
> 
> /usr/bin/application-name
> 
> This seems to work great in general, but I'm observing an odd behavior that
> doesn't make much sense to me - but maybe someone else can explain and/or
> offer another solution.
> 
> If I'm at the Nokia's desktop, plug the unit into the charger, and hit the
> power button to turn the Nokia off, a black screen comes up with the word
> 'Charging' with an animated battery icon.  BUT, after a few seconds, the
> application I am trying to auto-start pops up onto the screen, but is
> unresponsive (the touch screen does not work).
> 
> Anyone have any idea why this is happening?  
> 

Looking at the file you've edited, it appears to be run at startup and 
shutdown (which is why it's got the "case" structure dependent on $1)

So what's happening is that the script is evaluating a "stop" argument, 
running what's relevant to it, then after it finishes what's within 
the "case" structure (which ends with "esac") it's running your program, 
because you've put it in at the end of the file.

Unless your program is backgrounding itself, nothing else is going to happen 
until it stops. But because of where you've put it, it will run even on 
shutdown.

Ideally you ought to have your own init script for the program, which should 
be in /etc/init.d, symlinked into the various rc directories. It will need 
commands to start and stop the program as appropriate (I usually find it 
easier to copy an existing init file and adapt it rather than trying to write 
my own from scratch.)

Don't forget that the startup script needs to background the process it starts 
(otherwise it'll block the rest of the system initialisation) and it needs to 
exit with a zero return code to ensure the init process continues OK.

-- 
Tony Green
Ipswich, Suffolk, England
http://www.beermad.org.uk
http://no2id-ip.web-brewer.co.uk

** This message is digitally signed. If your email client is unable to read 
digital signatures, you may see an attachment that you cannot open. See 
http://www.gnupg.org/(en)/documentation/faqs.html for more information.
You can validate my PGP key from my website: http://www.beermad.org.uk/
* No Micro$oft products were used in the generation of this communication
-- 
Tony Green
Ipswich, Suffolk, England
http://www.beermad.org.uk
http://no2id-ip.web-brewer.co.uk

** This message is digitally signed. If your email client is unable to read 
digital signatures, you may see an attachment that you cannot open. See 
http://www.gnupg.org/(en)/documentation/faqs.html for more information.
You can validate my PGP key from my website: http://www.beermad.org.uk/
* No Micro$oft products were used in the generation of this communication
-- 
Tony Green
Ipswich, Suffolk, England
http://www.beermad.org.uk
http://no2id-ip.web-brewer.co.uk

More information about the maemo-developers mailing list