Bitcoin Forum
December 03, 2016, 12:20:43 AM *
News: To be able to use the next phase of the beta forum software, please ensure that your email address is correct/functional.
 
   Home   Help Search Donate Login Register  
Pages: [1]
  Print  
Author Topic: Auto Start script  (Read 937 times)
flatronw
Jr. Member
*
Offline Offline

Activity: 50


View Profile
May 27, 2012, 06: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 <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


1480724443
Hero Member
*
Offline Offline

Posts: 1480724443

View Profile Personal Message (Offline)

Ignore
1480724443
Reply with quote  #2

1480724443
Report to moderator
1480724443
Hero Member
*
Offline Offline

Posts: 1480724443

View Profile Personal Message (Offline)

Ignore
1480724443
Reply with quote  #2

1480724443
Report to moderator
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
1480724443
Hero Member
*
Offline Offline

Posts: 1480724443

View Profile Personal Message (Offline)

Ignore
1480724443
Reply with quote  #2

1480724443
Report to moderator
gweedo
Legendary
*
Offline Offline

Activity: 1246


Java, PHP, HTML/CSS Programmer for Hire!


View Profile WWW
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.

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in https://goseemybits.com/lobby
Pages: [1]
  Print  
 
Jump to:  

Sponsored by , a Bitcoin-accepting VPN.
Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!