Bitcoin Forum
May 25, 2024, 08:13:28 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: Auto Start script  (Read 1088 times)
flatronw (OP)
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
May 27, 2012, 06:18:03 AM
Last edit: May 27, 2012, 04:12:02 PM by flatronw
 #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 <options>


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 miner@192.168.1.49                                     <ENTER>
miner@192.168.1.49's password: miner                 <ENTER>
miner@miner:~$ cd /home/miner/cgminer-2.3.2    <ENTER>
miner@miner:~/cgminer-2.3.2$ sudo ./cgminer     <ENTER>
[sudo] password for miner: miner                         <ENTER>

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


gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
May 27, 2012, 08: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.
Pages: [1]
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!