Reply
Thread Tools
Posts: 4 | Thanked: 1 time | Joined on Feb 2010
#1
Hello.

What is the Maemo way of starting python applications at boot?
Is there some convention that people should follow?

I am working on small python application that I would like to start automatically when device boots, but I haven't found any docs on what is the preferred way to do it in Maemo.

I could of course add script to /etc/init.d and then put it to runlevel in /etc/rc..., but is that the way I am supposed to use?

And if it is what runlevel I should use, /etc/rc3.d?
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#2
Originally Posted by jargon View Post
Hello.

What is the Maemo way of starting python applications at boot?
Is there some convention that people should follow?

I am working on small python application that I would like to start automatically when device boots, but I haven't found any docs on what is the preferred way to do it in Maemo.

I could of course add script to /etc/init.d and then put it to runlevel in /etc/rc..., but is that the way I am supposed to use?

And if it is what runlevel I should use, /etc/rc3.d?
maemo uses upstart, so you could create your startup files in /etc/event.d/ directory.
have a look there.
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 

The Following User Says Thank You to krk969 For This Useful Post:
Posts: 1,101 | Thanked: 1,184 times | Joined on Aug 2008 @ Spain
#3
maemo4 uses init.d, runlevel 2, and yes, if you want anything to run at startup use init.d scripts.
 
Posts: 4 | Thanked: 1 time | Joined on Feb 2010
#4
I got the auto start working with following script in /etc/event.d

--
console logged

start on started hildon-desktop
stop on stopped dbus

exec /usr/bin/python /home/user/script.py
---

I also used chroot +r on the startup script as all built in scripts seemed to be world readable, not sure if that is needed.

Now the what is proper place for python applications in N900?
/usr/bin?
 

The Following User Says Thank You to jargon For This Useful Post:
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#5
Originally Posted by jargon View Post
I got the auto start working with following script in /etc/event.d

--
console logged

start on started hildon-desktop
stop on stopped dbus

exec /usr/bin/python /home/user/script.py
---

I also used chroot +r on the startup script as all built in scripts seemed to be world readable, not sure if that is needed.

Now the what is proper place for python applications in N900?
/usr/bin?
i would think its best optified
so pls put them in /opt
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 

The Following User Says Thank You to krk969 For This Useful Post:
Posts: 2 | Thanked: 0 times | Joined on May 2010
#6
Good Day,

I tried to auto start a simple "hello.py" script with the following content:

import gtk
from gtk import Window, Button, Widget
if __name__ == "__main__":
window = Window(gtk.WINDOW_TOPLEVEL)
window.connect("destroy", gtk.main_quit)
button = Button("Hello World")
button.connect_object("clicked", Widget.destroy, window)
window.add(button)
window.show_all()
gtk.main()

Here is the content of my startup script located on "event.d" folder.

start on startup
stop on starting shutdown

exec /usr/bin/python /home/user/hello.py


I am expecting that my hello.py be loaded on startup but it did not appear. My hello.py is working if i execute this command on xterminal:

python /home/user/hello.py

What could be the problem?

Thank you.
 
Posts: 726 | Thanked: 345 times | Joined on Apr 2010 @ Sweden
#7
For GTK to be able to render anything, you need a running X client that's ready to do that. If you try to run your Python program too early, it will not work.

Start it after the hildon-home application has started and it might get a bit closer to working. Since the X startup mechanics have been tinkered with a bit on the N900, it's not as easy as usual to do things like these.
 
Posts: 2 | Thanked: 0 times | Joined on May 2010
#8
Thank you for the immediate response. I also tried the following script:

start on started hildon-desktop
stop on starting shutdown

exec /usr/bin/python /home/user/hello.py

but still no avail.

What if my python script is just a simple console script? I just want to make my script run every time my N900 starts. What is the best way to do this?

Thank you for your assistance.
 
krk969's Avatar
Posts: 754 | Thanked: 630 times | Joined on Sep 2009 @ London
#9
not an expert with upstart, but have you tried ?

start on started hildon-desktop
start script
exec run-standalone.sh /usr/bin/python /home/user/hello.py
end script
__________________
Developer of :
Buddy - budget/expense manager ( website )
Showtime - a telly channel listing viewer/reminder ( website )
Travelapp - london underground status/planner ( website )
Batlevel - desktop widget for battery level ( website )

“I hear and I forget. I see and I remember. I do and I understand.”
 
Reply


 
Forum Jump


All times are GMT. The time now is 13:46.