wiki:HowToRunProgramAtStartupPiZero

Check out the following URLs for examples and reference information:

http://www.mikeslab.net/?p=176 http://wiki.debian.org/LSBInitScripts

Highlights from this page:

NOTE: Use ‘sudo’ to perform these operations as root in a Raspbian shell…

Create an LSB style init script for launching a PiBot autonomous startup app.

  • I copied rc.local as a starting point and modified it to run my desired - PiBot app as follows:
    • sudo cp /etc/init.d/rc.local /etc/init.d/pibot_auto
    • sudo vi /etc/init.d/pibot_auto
    • Revise the header block to describe PiBot autonomous app
    • Revise the do_start() to launch the PiBot autonomous app
    • Save and exit editor
    • Test/debug the script until it works as desired using these commands:
    • sudo /etc/init.d/pibot_auto start
    • sudo /etc/init.d/pibot_auto stop
    • sudo /etc/init.d/pibot_auto restart When working as desired, register script to run at startup/shutdown:
    • sudo update-rc.d pibot_auto defaults If the script is changed (edited) after registering, a ‘reload’ may be necessary as follows:
    • sudo systemctl daemon-reload To unregister the script (i.e., stop it from running at startup/shutdown):
    • sudo update-rc.d -f pibot_auto remove
Last modified 5 years ago Last modified on Sep 27, 2016, 11:40:58 PM