Bitcoin Forum
April 23, 2024, 03:41:45 PM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: « 1 [2]  All
  Print  
Author Topic: Is there a tutorial for using screen to auto start cgminer?  (Read 29234 times)
jake262144
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 21, 2012, 11:07:56 PM
 #21

Why the sad face? Do you think I didn't read the man page?
I was just faster with man screen | grep Reattach  Cheesy
1713886905
Hero Member
*
Offline Offline

Posts: 1713886905

View Profile Personal Message (Offline)

Ignore
1713886905
Reply with quote  #2

1713886905
Report to moderator
"Bitcoin: mining our own business since 2009" -- Pieter Wuille
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1713886905
Hero Member
*
Offline Offline

Posts: 1713886905

View Profile Personal Message (Offline)

Ignore
1713886905
Reply with quote  #2

1713886905
Report to moderator
1713886905
Hero Member
*
Offline Offline

Posts: 1713886905

View Profile Personal Message (Offline)

Ignore
1713886905
Reply with quote  #2

1713886905
Report to moderator
check_status
Full Member
***
Offline Offline

Activity: 196
Merit: 100


Web Dev, Db Admin, Computer Technician


View Profile
February 22, 2012, 01:24:58 AM
Last edit: February 22, 2012, 08:06:36 AM by check_status
 #22

It's a good thing that jake262144 is n00b friendly... Cheesy

A Debian install guide would be excellent with a compile cgminer from source section with suggestions on methods to locate dependancies.
To locate dpendencies I use 'apt-cache search' and 'apt-cache show', but they're not useful for things outside the repo's like libpcap or poclbm p2pool.
A minimal install including only absolutely necessary services. For instance, when I install Ubuntu it always runs bluetooth as it boots up. Since I don't have anything bluetooth I resort to 'apt-get remove 'package' ' but some things are tied to network manager and audio so must be selective when on a usable desktop.

Code:
dpkg --get-selections | grep blue
bluez      install
gnome-bluetooth install
libbluetooth3 install
libgnome-bluetooth8 install

So far, this bash session has been great. Thanks.

For Bitcoin to be a true global currency the value of BTC needs always to rise.
If BTC became the global currency & money supply = 100 Trillion then ⊅1.00 BTC = $4,761,904.76.
P2Pool Server List | How To's and Guides Mega List |  1EndfedSryGUZK9sPrdvxHntYzv2EBexGA
kano
Legendary
*
Offline Offline

Activity: 4466
Merit: 1798


Linux since 1997 RedHat 4


View Profile
February 22, 2012, 03:52:47 AM
 #23

...
with a compile cgminer from source section with suggestions on methods to locate dependancies.
To locate dpendencies I use 'apt-cache search' and 'apt-cache show', but they're not useful for things outside the repo's like libpcap or poclbm.
...
It's in the README already ...
But 'poclbm' Huh Eh?

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
check_status
Full Member
***
Offline Offline

Activity: 196
Merit: 100


Web Dev, Db Admin, Computer Technician


View Profile
February 22, 2012, 08:14:49 AM
 #24

...
with a compile cgminer from source section with suggestions on methods to locate dependancies.
To locate dpendencies I use 'apt-cache search' and 'apt-cache show', but they're not useful for things outside the repo's like libpcap or poclbm.
...
It's in the README already ...
I checked the libpcap README and there were no dependencies listed.
But 'poclbm' Huh Eh?
My bad, brain fade, I was thinking of p2pool when I wrote that. For compiling, I wanted one example that lists dependencies and one that didn't.
Quote
Dependencies for running from source:
Bitcoin 0.5.0 or higher
Python 2.5 or higher
python-argparse for Python 2.6 and lower
Twisted (Ubuntu package python-twisted)

For Bitcoin to be a true global currency the value of BTC needs always to rise.
If BTC became the global currency & money supply = 100 Trillion then ⊅1.00 BTC = $4,761,904.76.
P2Pool Server List | How To's and Guides Mega List |  1EndfedSryGUZK9sPrdvxHntYzv2EBexGA
jake262144
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 22, 2012, 08:21:20 AM
Last edit: February 22, 2012, 09:01:25 AM by jake262144
 #25

For instance, when I install Ubuntu it always runs bluetooth as it boots up. Since I don't have anything bluetooth I resort to 'apt-get remove 'package' ' but some things are tied to network manager and audio so must be selective when on a usable desktop.
Forget apt-get, use aptitude. It has an awesomely useful parameter why to help you sort out the dependencies:

# aptitude why python
i   python-pyopencl Depends python (>= 2.5)


# aptitude why openssl
i   cups     Depends ssl-cert (>= 1.0.11)
i A ssl-cert Depends openssl (>= 0.9.8g-9)



You can also put any package (it does not have to be installed) on hold which will prevent installation, removal, or upgrade:
aptitude remove gnome-bluetooth && aptitude gnome-bluetooth= should do the job
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
February 28, 2012, 05:25:18 AM
 #26


/etc/rc.local should include this line, let's keep it clean:
Code:
/usr/local/bin/miner-launcher.sh 60 &
That 60 is passed as a parameter to miner-launcher. It will be used for specifying how long miner-launcher should wait before starting the miner.
The ampersand returns control to rc.local at once, without waiting for the whole minute until miner-launcher is done with its work.

I tried your method jake and I can call miner-launcher manually and it starts cgminer however despite having the above line in etc/rc.local "nothing" happens on boot.  Any ideas?
jake262144
Full Member
***
Offline Offline

Activity: 210
Merit: 100


View Profile
February 28, 2012, 10:28:46 AM
 #27

I tried your method jake and I can call miner-launcher manually and it starts cgminer however despite having the above line in etc/rc.local "nothing" happens on boot.  Any ideas?
I'll get to debugging it when I'm done with my work for today, it's gotta be some minor quirk as the code looks fine.
For the record, I came up with this three-file approach when JWU42 asked for advice.
I launch my miners in an even more convoluted way Smiley
DeathAndTaxes (OP)
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
February 28, 2012, 11:54:02 AM
Last edit: February 28, 2012, 12:36:45 PM by DeathAndTaxes
 #28

I tried your method jake and I can call miner-launcher manually and it starts cgminer however despite having the above line in etc/rc.local "nothing" happens on boot.  Any ideas?
I'll get to debugging it when I'm done with my work for today, it's gotta be some minor quirk as the code looks fine.
For the record, I came up with this three-file approach when JWU42 asked for advice.
I launch my miners in an even more convoluted way Smiley


It may not be a bug in your code maybe just by Linux noobishness showing (for a MS SQL database architect this is way outside my comfort zone Smiley ).  It seems like /etc/rc.local isn't even executing?  Is that possible?

On edit:  Don't have time to test it but I think it was just that I forgot to chmod +x rc.local ...
nathanghart
Full Member
***
Offline Offline

Activity: 195
Merit: 100


View Profile
March 06, 2012, 04:15:05 AM
 #29

Bump - yes i know it's old...
Is this still the best method?
Which part? There is no substituting the command like screen -dmS miner startminer.sh


What can be changed, is the manner in which the above command is invoked - on my Debian-based machines, rather than launch cgminer via /etc/rc.local and call it a day I've set it up to start as a system service. With some scripting this allows me to do control it like any other OS daemon, e.g.
Code:
/etc/init.d/bcm0 start - invokes the time-honored [i]screen -dmS bcm-0 bcm-start.sh cgminer[/i] command[sup](1)[/sup]
/etc/init.d/bcm0 stop
/etc/init.d/bcm0 restart
/etc/init.d/bcm0 getstatus - prints whether or not cgminer is up and running, returns an exit status 1 if it isn't
/etc/init.d/bcm0 getpid - prints the PID of the active cgminer executable or returns an exit status 1 if cgminer isn't running

The service can be trivially disabled via the daemon control tool [i]update-rc.d[/i]:
update-rc.d bcm0 disable

Cgminer is only invoked via an intermediary script, /usr/local/bin/bcm-start.sh, which can launch a whole array of miners (the other ones being phoenix, diabloMiner, and ufasoft's cpuminer)
This way, whatever miner I want to launch, I don't have to mess with the /etc/init.d files.

The X.org server - a prerequisite - is being launched the same exact way.

The logging module is also tightly integrated into the system, logging some pertinent parameters of the mining rig with a 6 minute interval.
Cgminer output is being kept on-record as well so that it is easily accessible should errors crop up and need to be trouble-shot.


To ensure update flexibility and safety, I have been using the following set up:
Four concurrent versions of cgminer can coexist; they are labeled cgminer-stable, -testing, -oldstable, and -oldtesting and reside in their own respective directories.
Upon being installed, a new cgminer compilation is assigned the testing status by default.
Its status can be changed, e.g. to stable at any given time.

All cgminer calls are processed via a symlink named cgminer-current which always links to one of the four directories.

To make sense of four cgminer executables which can in some cases have the same version number but are based on different git commits, I needed to create an automatic cgminer installer (cgminer-update.sh) which creates the version.info file (containing the git version) in the installation directory.
A fresh copy of cgminer source will be downloaded from git, compiled and automatically installed into /opt/bcm/cgminer-testing.


I find it that such a tight integration with the OS is the right approach to take in machines as purpose-built as mining rigs are.
I tried hard to fit miners and miner control into the OS as snugly as possible, to stay true to the "Debian way" - whatever is might be Wink


If anyone's interested, I might write a guide and share some code... just give me some time to do that, a week or two(2) as I do have a day job and other real-life commitments...

Does anyone want this?

Notes:
(1) actually, the user is also being changed with su bcminer so that cgminer doesn't run as root which would be a horribly wrong idea from the system security standpoint.
(2) ummm... how does a "4 to 6 weeks" timeframe sound to you, guys? Tongue
    

count me in. thanks.
JWU42
Legendary
*
Offline Offline

Activity: 1666
Merit: 1000


View Profile
April 29, 2012, 03:07:05 AM
 #30

Finally got this working bump  Smiley

flatronw
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
June 01, 2012, 01:05:32 PM
 #31

Finally got this working bump  Smiley

I know these are old post but please do Noob a favour and explain how

I am using Xubuntu 11.04 (on HDD) and CGMiner 2.3.2

I have followed the instructions in post #14 to the letter. (I think?)

 I can start the Miner from a terminal e.g “ Miner-launcher.sh” Everything works fine. Have Screen, SSH etc etc.
However I cannot get the thing to “auto start” via the /etc/rc.local
 (done  chmod +x  /etc/rc.local)

I have in /etc/rc.local as below, I have tried commenting out “rc.local” and “exit 0“ and “-e" with chmod +x after any changes
-------------------------------------------------------------------------------------
#!/bin/bash -e
/usr/local/bin/miner-launcher.sh 60 &
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.



exit 0
-----------------------------------------------------------------------------------------

For someone who knows Linux this is probably ridiculously easy!

Thanks
nathanghart
Full Member
***
Offline Offline

Activity: 195
Merit: 100


View Profile
June 05, 2012, 04:59:07 AM
 #32

Finally got this working bump  Smiley

I know these are old post but please do Noob a favour and explain how

I am using Xubuntu 11.04 (on HDD) and CGMiner 2.3.2

I have followed the instructions in post #14 to the letter. (I think?)

 I can start the Miner from a terminal e.g “ Miner-launcher.sh” Everything works fine. Have Screen, SSH etc etc.
However I cannot get the thing to “auto start” via the /etc/rc.local
 (done  chmod +x  /etc/rc.local)

I have in /etc/rc.local as below, I have tried commenting out “rc.local” and “exit 0“ and “-e" with chmod +x after any changes
-------------------------------------------------------------------------------------
#!/bin/bash -e
/usr/local/bin/miner-launcher.sh 60 &


I notice you have a capital "M" there as in Miner-launcher.sh where the script has it not capitalized. I am not sure that you named the script Miner-launcher.sh, but if you did it would not launch from rc.local unless it matches case.
flatronw
Newbie
*
Offline Offline

Activity: 50
Merit: 0


View Profile
August 24, 2012, 12:01:40 PM
Last edit: August 24, 2012, 03:11:39 PM by flatronw
 #33

For BTC Keeper

At the outset I dont know shit about Linux but the following works for me. It basically came from this post Topic but it took me a while to get it sorted out. Everybody who posts seems to assume that every one else reading has the same skill levels as they do and they leave little "Important" bits out. I will try not to do that so if it is all a bit basic I aplogise!

Use these two scripts, the first named "stminer.sh" the second named "cgmlaunch.sh" As you can see both these are .sh files. You need to create those .sh files with the posted text inside. And make them executable
----------------------------------------------
#!/bin/sh
screen -dmS 051 ./cgmlaunch.sh
------------------------------------------------
and
------------------------------------------------
#!/bin/sh
sleep 60
export DISPLAY=:0
xhost +
now="`date +%Y%m%d%H%M%S`"
cd /home/miner/cgminer-2.3.2
./cgminer   2>log.$now$$.10151.txt
------------------------------------------------
If you look at the second script you will see the line "cd /home/miner/cgminer-2.3.2"
That shows you the directory where both scripts need to be put ie your equivalent of /home/miner. Where miner is your "named" directory. You need to give both scripts execution rights by chmod or the easy way just use the properties box/permissions and check "allow execution". You need to change "cgminer-2.3.2" to whatever you have called your installed version of cgminer and it must be in that "/miner" directory

The first script starts Screen, names it .051 and then it starts the second script, which waits 60 seconds then starts cgminer and creates a log file called 10151.txt in your cgminer directory. If you dont want the log file delete "2>log.$now$$.10151.txt" from the last line of the second script
(Use the cgminer.config file in  /home/miner/.cgminer for your GPU parameters.)

To get the first script to run at start-up you need to use the Startup Applications in Ubuntu, go to System/Preferences/Startup Applications click Add, put in a description eg "Start CGMiner" then browse to find the first script, in my case called "stminer.sh" select it, make sure the box is ticked and exit.

If all has gone according to plan and I have not left any important little bits out. When you reboot you machine will eventually start and run your cgminer. BUT it will start in "Headless Mode"
You can ssh into the machine and use Screen to view the CGMiner data.
I am guessing but I think, if you dont want Screen to run then maybe if you were to select the second script ie "cgmlaunch.sh" instead of the first in the Startup Application then maybe it will start cgminer directly.

Hope this ease's the pain.

I am sure there are more elegant and sophisticated ways of doing the above. However this has worked flawlessly for me on two machines for more than 6 months. Both on USB boot and HDD boot and its Newbie do-able!


Edit:- corrected last line of the second script to read as per the correction in Kano's post below.

This is cut and paste of the last line of the second script from one of my running miners:-  ./cgminer 2>run.$now.$$.log10151.txt




kano
Legendary
*
Offline Offline

Activity: 4466
Merit: 1798


Linux since 1997 RedHat 4


View Profile
August 24, 2012, 12:34:21 PM
 #34

./cgminer   2> log.$now.$$.txt

Pool: https://kano.is - low 0.5% fee PPLNS 3 Days - Most reliable Solo with ONLY 0.5% fee   Bitcointalk thread: Forum
Discord support invite at https://kano.is/ Majority developer of the ckpool code - k for kano
The ONLY active original developer of cgminer. Original master git: https://github.com/kanoi/cgminer
Pages: « 1 [2]  All
  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!