Hey
Which file, line of code, script or whatever, would I use to auto boot up into a (self built) python program?
Ta!
Boot To Python Program
4 posts
- Posts: 11
- Joined: Tue May 22, 2012 10:21 am
- Location: Welbeck
It depends what you want it to do
To run as a background daemon
/etc/init.d/<appname>
- 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/ )
To run as a background daemon
/etc/init.d/<appname>
- 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/ )
If your looking to run your program as a daemon (in the background), see this post, http://www.stuffaboutcode.com/2012/06/raspberry-pi-run-program-at-start-up.html, for info on how to set it up.
LHIS
LHIS
"am I getting slower, or is stuff more complicated; either way I now have to write it down - stuffaboutcode.com"
This code should clear up how raspi-setup (PiBang) and raspi-config(Raspbian) boot
- Code: Select all
#!/bin/sh
# Part of raspi-setup http://github.com/super-nathan/raspi-setup
#
# See LICENSE file for copyright and license details
# Should be installed to /etc/profile.d/raspi-config.sh 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"
else
raspi-setup
exec login -f pi
fi
echo "Something Useful" > /dev/null