Bitcoin Forum
June 26, 2017, 10:47:24 AM *
News: Latest stable version of Bitcoin Core: 0.14.2  [Torrent].
   Home   Help Search Donate Login Register  
Pages: [1]
Author Topic: Auto Start script  (Read 966 times)
Jr. Member
Offline Offline

Activity: 50

View Profile
May 27, 2012, 06:18:03 AM

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

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

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@                                     <ENTER>
miner@'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)


Edit --- Update

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

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??


+50% Profit and more via TELEGRAM
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction. Advertise here.
Hero Member
Offline Offline

Posts: 1498474044

View Profile Personal Message (Offline)

Reply with quote  #2

Report to moderator
Offline Offline

Activity: 1246

Java, PHP, HTML/CSS Programmer for Hire!

View Profile WWW
May 27, 2012, 08:08:04 AM

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
and it should keep the session running or look into
another command that does the same thing.

Want to earn 2500 SATOSHIS per hour? Come Chat and Chill in
Pages: [1]
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!