Bitcoin Forum
May 28, 2024, 03:24:03 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1]
  Print  
Author Topic: How to run CGminer in background and/or on startup (Guide)  (Read 6958 times)
waa (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 05, 2013, 09:22:30 AM
 #1

Since I am unable to post anywhere else I guess I'll post this here.


Something that has bothered me about CGminer is the annoying window that I could only minimize to the taskbar - so I went about setting this up so it runs in the background and even starts when my system does.
I guess this could be used for other "purposes" because it makes CGminer invisible unless you look at processes, but it's your prerogative how you wish to use this. This guide will only work for windows users, I may create one for linux users in the future.

And since this is the "newbies" section I'll start from the beginning:


First, of course, you need CGminer:

http://ck.kolivas.org/apps/cgminer/


CGminer can be a little daunting to someone new to all of this so here is an easy guide written by someone here:

http://pastebin.com/YZatjsx4

*Make sure you do update your cgminer.conf file with your settings and not just run it from the .bat you originally created - how to do that is at the bottom of the guide linked above.



Okay, so once you have CGminer actually set up and working we can go about getting it to run in the background.

*Remember, this makes CGminer nearly invisible - you will need to open up your task manager and click on the "Processes" tab to see it. (Access the task manager by using CTRL+ALT+DEL)



All you need to do is create a new .txt file in your CGminer folder (Right click, new, Text Document)

*Name it something like "NoWindow" so you remember what it is.

Now, paste the following in the text document:


Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & "The directory of your cgminer.exe" & Chr(34), 0
Set WshShell = Nothing


*Replace "The directory of your cgminer.exe" with the correct directory of YOUR cgminer.exe, but leave the parentheses.

*Example: "C:\Bitcoin\cgminer-3.1.0-windows\cgminer.exe"    that's what I enter there for my directory.


Now, you need to change the file extension to .vbs from .txt (In order to do this click on start, in the search type in "Folder Options", click on the "View" tab, uncheck "Hide extensions for known file types". Then simply right click the and select rename - you can change the .txt on the end to .vbs.



Now if you wish to start cgminer in invisible mode just double click the .vbs file.

*Open up the task manager and check to see if it's working.




Okay, if you want to also have CGminer start when your computer does all you need to do is create a shortcut (right click, Create Shortcut) and move that to your startup programs folder.

To get to your startup programs folder you first need to go back to "Folder Options" (click on the "View" tab, select (dot) "Show hidden files, folders, and drives").

Now copy your .vbs shortcut into C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup.



Now your done! I recommend you restart your computer and check the Task Manager to make sure it is working.

To disable it as a startup program either delete it from the "Startup" folder or disable it in msconfig.


I hope this helps a few people!





waa (OP)
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
May 05, 2013, 09:34:31 AM
 #2

Here is a link of this for future reference: http://pastebin.com/mSHgeYtz
isimme
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile
May 20, 2013, 07:25:13 PM
 #3

Hi Waa,

Thanks for posting!  Smiley
Very very helpful to me,
much appreciated.

Is there any way after hiding CGMiner to see
the command window without closing CGMiner
and restarting?

Best Regards

If I was able to help you in anyway, tips are appreciated:
1A1RcqRKdApT4ViLmZcdDBES8rov3zjMYp
klenker
Member
**
Offline Offline

Activity: 80
Merit: 10


Prospecting on the net, in a rundown old shack..


View Profile
June 05, 2013, 08:13:20 AM
 #4

This is so frustrating.

I am trying to write a front end gui for it in visual studio and I simply cannot get the console to redirect to the damn thing.

I can either start cgminer as normal, which includes hiding it as you've done, but if I try to use the only way I know to redirect console output, cgminer simply will not start. No error. No hint of starting. Just flicks up and gone.

Almost as if it's written to refuse to run should someone want to have the details inside a gui rather than a text console.

I give up. I have 2 monitors, I need it to start on the second so I can shut off the main one, and if I start the thing with a batch file or any script, it loads where it wants on the first monitor. Frustrating. So I thought write an app I can position myself, that grabs the info. No go.

jesus christ.. WHY...


BTC: 1LJk6Ck83fqwoCzFB7KqHVkurhsFfuk9zv
LTC: LP1LBMd4Cxth8uada3wF2kTZu8ub7LfyRH
FTC: 6gsQ1WqzpEi8ioQ3irkhjVj8z7Wznos12C
--
klimmbimm
Newbie
*
Offline Offline

Activity: 2
Merit: 0


View Profile
June 07, 2013, 09:16:28 AM
 #5

Set WshShell = CreateObject("WScript.Shell" )
WshShell.Run chr(34) & "The directory of your cgminer.exe" & Chr(34), 0
Set WshShell = Nothing

*Replace "The directory of your cgminer.exe" with the correct directory of YOUR cgminer.exe, but leave the parentheses.

It doesn't seem to work if I use cgminer with parameters e.g. as "C:\path\to\miner.exe -c C:\path\to\configuration.txt".

How do you insert server, port, username etc. if cgminer is running hidden?
isimme
Member
**
Offline Offline

Activity: 78
Merit: 10


View Profile
June 27, 2013, 01:53:32 AM
 #6

How do you insert server, port, username etc. if cgminer is running hidden?

Put server, port, username in your .bat file for it to work while hidden.

If I was able to help you in anyway, tips are appreciated:
1A1RcqRKdApT4ViLmZcdDBES8rov3zjMYp
milone
Sr. Member
****
Offline Offline

Activity: 434
Merit: 251


CGWatcher & CGRemote


View Profile WWW
June 27, 2013, 03:41:13 AM
 #7

You can also use CGWatcher to run cgminer hidden, then minimize CGWatcher to the system tray. This way you can bring up the window whenever you want to see stats and temps. On top of that, it fixes problems cgminer runs into to make sure it stays mining. There are also options for running on Windows startup. While I can understand reluctance to download and run executables, and encourage due diligence before doing so, 2,000+ users and growing should help attest it is not malicious.

More info and download:

http://manotechnology.blogspot.com/p/cgwatcher.html


Official thread:

https://bitcointalk.org/index.php?topic=185553.0


Newbie thread:

https://bitcointalk.org/index.php?topic=159267

CGWatcher, a GUI/monitor for CGMiner & BFGMiner: http://www.cgwatcher.com
CGRemote, a remote mining dashboard for all of your miners: http://www.minerremote.com
BTC: 12TAYjmSrdDHLNpmix2MG6y3R868SMM7Fx    LTC: LM6Un6hZvPzLBggJWiAVG6E6w2GfaHukXY
hashkey
Sr. Member
****
Offline Offline

Activity: 336
Merit: 250



View Profile
June 27, 2013, 03:56:18 AM
 #8

Quote
*Replace "The directory of your cgminer.exe" with the correct directory of YOUR cgminer.exe, but leave the parentheses.

*Example: "C:\Bitcoin\cgminer-3.1.0-windows\cgminer.exe"    that's what I enter there for my directory.

You mean leave the quotation marks Grin

Quote
I guess this could be used for other "purposes"


[WTS] 📞 Voice Call & 📩 SMS PV Services 📲 [non-US] ⏱️ Fast Service ✔️️✔️️✔️️ |
"Your effort to remain what you are is what limits you." ~ Puppet Master
legitnick
Hero Member
*****
Offline Offline

Activity: 532
Merit: 500



View Profile WWW
June 27, 2013, 04:04:42 AM
 #9

Good information in this thread, thanks a lot!

5 BITCOIN RAFFLE GIVEAWAY
"I dont lift" - Lord Furrycoat
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!