Author

Topic: Auto Start script (Read 1094 times)

legendary
Activity: 1498
Merit: 1000
May 27, 2012, 04:08:04 AM
#2
it shuts down cause your running SSH and when SSH gets terminated it shutdown all processes created by that user. Use can you use the command
Code:
screen
and it should keep the session running or look into
Code:
nohup
another command that does the same thing.
newbie
Activity: 50
Merit: 0
May 27, 2012, 02:18:03 AM
#1
Can somebody please assist a frustrated Linux noob?  I am trying to make an a “autostart script” work on a headless miner,  Xubuntu 11.04 (full install on HDD) using CGMiner 2.3.2.
 I have Googled and searched the Forum endlessly and can only find what to me are vague outlines of how to do this. After days of frustration with my limited knowledge of Linux I cannot get these scripts to run properly. The best of what I have been able to find are the two examples below which I have been trying to use as guides.

Ex 1

#!/bin/sh
host + &> /dev/null
now="`date +%Y.%m.%d.%H.%M.%S`"
cd ~/miners/cgminer  # or wherever your cgminer directory is
# logs/ is assumed to be in the cgminer directory
diff cgminer.conf $(ls -1 logs/*.conf | tail -n 1) &> /dev/null || cp cgminer.conf logs/$now.conf
DISPLAY=:0 cgminer -c cgminer.conf 2> logs/$now.log

Ex 2

#!/bin/sh
export DISPLAY=:0
xhost +
screen -d -m -S cgminer cgminer


At the moment if I want to start and run this Miner I do the following, turn on the AC power to the Miner, after it boots, log-in from my Laptop:-

ssh [email protected]                                    
[email protected]'s password: miner                
miner@miner:~$ cd /home/miner/cgminer-2.3.2    
miner@miner:~/cgminer-2.3.2$ sudo ./cgminer    
[sudo] password for miner: miner                        

and the Miner starts using the parameters entered previously in the cgminer.conf which is located in:-  /home/joeblow/.cgminer.

However I cannot close the Terminal or disconnect the laptop as the Miner shuts down.

What I am trying to achieve is a miner that will auto start on the restoration of the AC power and boot into screen after about a 240 second sleep. I am not concerned with logging etc. I simply want it to start by using the established cgminer.conf and boot into screen so I can log-in and out from a laptop.

Idea’s pleeease!!!   (I dont want to go back to the “DarkSide”..........Windoze)

Mike



Edit --- Update

Now have script "miner.sh" below in /home/joeblow  The script will run from the terminal ie "sudo ./miner.sh"   However it will not start/run thru the Settings/Application AutoStart panel.

#!/bin/sh
sleep 30
screen -d -m -S cgminer
export DISPLAY=:0
xhost +
cd ~/cgminer-2.3.2/
now="`date +%Y%m%d%H%M%S`"
./cgminer ## .... 2> run.$now.$$.log


Anybody know what it is that I am not doing??

Mike


Jump to: