Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I have a python application that uses pygame to access the framebuffer directly without using X. I want to start this application on startup instead of showing the console login prompt. I haven't found any good resources which explains how I would do it.

Just the same way gdm is started instead of showing a console login prompt.

Bonus question: What would happen if said application crashed? Would the console login prompt be shown?

Edit: I have been reading up on runlevels and startup. More specific question below

Will it be enough to create a /etc/init.d script which starts my python program, update rc.d with update-rc.d and setting priority to 99 so that it runs last and setting it to run under runlevel 5 (Which is for gui applications I heard). Then changing the default runlevel 5 in /etc/inittab?

Or do I have to do something special since the program uses framebuffer?

share|improve this question

1 Answer 1

up vote 2 down vote accepted

You can try to run directy on the inittab... try to edit the /etc/inittab and replace the

1:2345:respawn:/sbin/getty 38400 tty1

with

1:2345:respawn:/usr/bin/python /srv/game/game.py

If the game crashes, init will restart it again. The game probably needs to know that is should open tty1 (or any other at your choice)

if you need the console, the other terminals should be normal, so ctrl+alt+F2 should jump to a login console

If you want to try with the runlevel, you are on good track... you probably need to define a TTY (probably export TTY=/dev/tty1) so the app knows where it should connect (as inittab and rc script run without any TTY defined). As i don't know python nor framebuffer consoles, dont know how to do that in python and what else is needed (maybe a more framebuffed or python direct question on stackoverflow is needed)

share|improve this answer
    
Thank you for the answer! That's interesting, didn't know you could do that. It seems easier too! I will try this out later today and get back to you. –  rzetterberg Mar 11 '13 at 8:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.