I've tried several times with slightly different tutorials (including here) to run a bash script when my Pi boots, however still no luck.
I have a simple script that uses screen
which I installed so I can run this service, disconnect and check progress via ssh any time.
The script, called mine, reads
#!/bin/bash
sleep 5
screen -dmS mine bash
screen -S mine -X stuff "/home/osmc/m-cpuminer-v2-2.4/m-minerd -a m7mhash -o stratum+tcp://xmg.suprnova.cc:7128 -u username.worker-p password -t 4 -e 100
"
I left out my login details here but essentially, I want to use screen to run a CPU miner on boot so if there's any power failure, reboot, what have you, it will automatically start a screen I can SSH into anytime there's a network connection.
I have placed the script in /etc/init.d, I ran update-rc.d mine defaults
, I tried update-rc.d mine defaults 100
as per another tutorial and even tried sudo ln -s /etc/init.d/mine /etc/rc6.d
all to no avail.
Placing a link to the script in .bashrc does work however, it starts a new session every time I log in when I only want one session to be running in the background.