Trying to run a c++ script upon boot on a raspberry pi.
I've tried placing it both in /etc/rc.local and using init.d, but no luck.
Then I tried it at the command line, and received an error:
Code:
michael@raspberrypi:/etc/init.d $ /home/michael/cplusclient/build/cplusclient
Failed to open cplusclient.ini, error: No such file or directory
michael@raspberrypi:/etc/init.d $
But this doesn't create an error:
Code:
michael@raspberrypi:/etc/init.d $ cd /home/michael/cplusclient/build
michael@raspberrypi:~/cplusclient/build $ .cplusclient
My current thoughts are to create the following shell script and run it upon boot:
Code:
michael@raspberrypi:/etc/init.d $ cat cplusclient.sh
#!/bin/bash
cd /home/michael/cplusclient/build
cplusclient &
michael@raspberrypi:/etc/init.d $ cat cplusclient
#!/bin/bash
# /etc/init.d/cplusclient
### BEGIN INIT INFO
# Provides: my client
# Required-Start: $remote_fs $syslog
# Required-Stop: $remote_fs $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: bla bla bla
# Description: Start my client
### END INIT INFO
#/home/michael/cplusclient/build/cplusclient &
./cplusclient &
michael@raspberrypi:/etc/init.d $
Questions...
Am I generally doing this correct?
Do I need to run both cplusclient and cplusclient.sh in the background or just one of the two? If just one, which one?
EDIT. One more question. How do I deal with the following?
Code:
michael@cplusclient:/etc/init.d $ sudo update-rc.d cplusclient defaults
insserv: warning: script 'cplusclient.sh' missing LSB tags and overrides
michael@raspberrypi:/etc/init.d $
EDIT 2. I think I am just confusing myself. LSB errors are due to not having the appropriate comments/etc. More importantly, why use two files? For some reason, I thought I needed a sh extension on one, but now I am thinking I need to use just cplusclient and put the cd in there...
Thanks