Sunday 8 June 2014

Starting applications at boot

So by now you've likely written a few applications for your little BBB and you're thinking, 'hey, sure would be nice if these ran at boot'.

Here is some things I've found to make your life easier when doing this.

First off from this fellow:
http://stackoverflow.com/questions/7221757/run-automatically-program-on-startup-under-linux-ubuntu

you want to create an init script called 'yourscript' and put in init.d, make it excecutable and add it to the update-rc.d with default parameters as below

sudo mv /filename /etc/init.d/
sudo chmod +x /etc/init.d/filename 
sudo update-rc.d filename defaults 
If you've never created an init script before there is a template on github:
which details the adding and use.  
Once added these are helpful commands:
/etc/init.d/algorithms start
/etc/init.d/algorithms stop
/etc/init.d/algorithms status
Also anything you put on stdout and stderr should show up in the log files here:
 /var/log/scriptname.log and error output to /var/log/scriptname.err

No comments:

Post a Comment