***Work in progress, if it does not work, please leave a comment***
With my Raspberry Pi, I often want that a program to start automatically at boot time. This is great to start a web server instance listening on a particular port, or any kind of server/background process. There is probably a couple of these program launcher but I could not find one easy to use and that do exactly what I wanted, so I decided to write one.
In Debian, the usual way to start a program at boot is to use init scripts. PiLaunchPad use a init script to start a python program that launches other program according to the content of a log file located in the pi user home directory. It comes with terminal command pilaunch that is used to control startup applications.
To install PiLaunchPad you need to download the distribution file:
Extract it with tar:
tar -xf PiLaunchPad-0.1.1.tar.gz
Move inside the extracted directory, and install the program
sudo python setup.py install
sudo python setup.py post_install
The post install step is needed to change some files permissions (make them executable)
Once installed, the next time you reboot your Pi, the provided init script will try to launch your enabled startup applications. You manage your startup programs with pilaunch
To add a startup programuyou first must ensure that it is executable (chmod +x program_name). If the program is a Python script, do not forget your shebang line (#! /usr/bin/python). Next, you have to go to the program directory and issue this command:
pilaunch -a program_name
For example, if I have 2 programs, named sleep1.py and sleep2.py, once they are added to the startup file, I can list them:
When the program are in the enabled state, this means that they will start automatically at the next boot.
You can disable a program pilaunch -d sleep1
Re-enable it pilaunch -e sleep1
Kill it pilaunch -k sleep1
Or manually start it pilaunch -s sleep1