Posts: 11
Joined: Tue May 22, 2012 10:21 am
Location: Welbeck

Boot To Python Program

Mon Nov 05, 2012 2:10 pm


Which file, line of code, script or whatever, would I use to auto boot up into a (self built) python program?


User avatar
Posts: 358
Joined: Tue May 08, 2012 9:11 am
Location: UK
Contact: Website

Re: Boot To Python Program

Mon Nov 05, 2012 4:20 pm

It depends what you want it to do

To run as a background daemon
- then register using update-rc.d
or use /etc/rc.local

To have it run on login - without X starting
add a script to /etc/profile.d
(I believe this is how raspi-config runs on first startup)

Note autologin can be handled by including the following line in /etc/inittab
1:2345:respawn:/bin/login -f pi tty1 </dev/tty1 >/dev/tty1 2>&1

To have it run as a GUI application once X has started
Add an <appname>.desktop file to ~/.config/autostart/ )

User avatar
Posts: 350
Joined: Sat May 26, 2012 6:40 am
Location: UK
Contact: Website

Re: Boot To Python Program

Tue Nov 06, 2012 8:53 am

If your looking to run your program as a daemon (in the background), see this post, ... rt-up.html, for info on how to set it up.

"am I getting slower, or is stuff more complicated; either way I now have to write it down -"

User avatar
Posts: 67
Joined: Sun Jun 17, 2012 6:56 am
Location: South Korea
Contact: Website

Re: Boot To Python Program

Wed Nov 07, 2012 2:12 am

This code should clear up how raspi-setup (PiBang) and raspi-config(Raspbian) boot

Code: Select all

# Part of raspi-setup
# See LICENSE file for copyright and license details

# Should be installed to /etc/profile.d/ to force raspi-config 
# to run at initial login

# You may also want to set automatic login in /etc/inittab on tty1 by adding a 
# line such as:
# 1:2345:respawn:/bin/login -f root tty1 </dev/tty1 >/dev/tty1 2>&1 # RPICFG_TO_DISABLE

# If you are trying to make this run on boot for a machine that has already been configured,
# then if you follow all the above instructions you will still be booted into an X session.
# If you <ctlr>+<alt>+<f1> you will find the raspi-config there ready to run. 
# In order to boot straight into Raspi-config you must disable lightdm with 
# $ sudo update-rc.d lightdm disable
# Then when you reboot the machine, you will be sent straight into the config.

if [ $(id -u) -ne 0 ]; then
  printf "\nNOTICE: the software on this Raspberry Pi has not been fully configured. Please run 'sudo raspi-setup'\n\n"
  exec login -f pi
echo "Something Useful" > /dev/null

Return to “Beginners”

Who is online

Users browsing this forum: youkiddin and 23 guests