| 45 | |
| 46 | |
| 47 | * Run a program at startup of Pi/Raspian: |
| 48 | |
| 49 | Check out the following URLs for examples and reference information: |
| 50 | |
| 51 | http://www.mikeslab.net/?p=176 |
| 52 | http://wiki.debian.org/LSBInitScripts |
| 53 | |
| 54 | Highlights from this page: |
| 55 | |
| 56 | NOTE: Use ‘sudo’ to perform these operations as root in a Raspbian shell… |
| 57 | |
| 58 | Create an LSB style init script for launching a PiBot autonomous startup app.[[BR]] |
| 59 | * I copied rc.local as a starting point and modified it to run my desired - PiBot app as follows: |
| 60 | * sudo cp /etc/init.d/rc.local /etc/init.d/pibot_auto |
| 61 | * sudo vi /etc/init.d/pibot_auto |
| 62 | * Revise the header block to describe PiBot autonomous app |
| 63 | * Revise the do_start() to launch the PiBot autonomous app |
| 64 | * Save and exit editor |
| 65 | * Test/debug the script until it works as desired using these commands: |
| 66 | * sudo /etc/init.d/pibot_auto start |
| 67 | * sudo /etc/init.d/pibot_auto stop |
| 68 | * sudo /etc/init.d/pibot_auto restart |
| 69 | When working as desired, register script to run at startup/shutdown: |
| 70 | * sudo update-rc.d pibot_auto defaults |
| 71 | If the script is changed (edited) after registering, a ‘reload’ may be necessary as follows: |
| 72 | * sudo systemctl daemon-reload |
| 73 | To unregister the script (i.e., stop it from running at startup/shutdown): |
| 74 | * sudo update-rc.d -f pibot_auto remove |
| 75 | |
| 76 | |
| 77 | |