Page 1 of 1

Running script in background

Posted: Mon Sep 15, 2014 9:01 am
by spinner
Hi,

I'm trying to run a process in the background so as when I log out it keeps running or I can add it to rc.local so as it starts automatically. I've got it working fine but the process hog's the whole of the cpu time, when I run it just in a terminal it uses fractions of percent of the cpu but in the background it's using around 90%.

I've tried

sudo ./cgminer -o <insert pool url> -u <username> -p <password> --api-allow W:0/0 --api-listen &

and also

sudo nohup ./cgminer -o <insert pool url> -u <username> -p <password> --api-allow W:0/0 --api-listen &

and a few variations to pipe the output to logging files.

Any help appreciated

Thanks.

Re: Running script in background

Posted: Mon Sep 15, 2014 12:01 pm
by RaTTuS
either run it via gnu screen [screen is very very very useful]
or attached to a spare terminal and get it to run on reboot see http://www.raspberrypi.org/forums/viewt ... 6&p=458534 for hints

Re: Running script in background

Posted: Mon Sep 15, 2014 12:40 pm
by cpc464
cgminer is a very specific program, not just a common shell tool. It may therefore have its own reasons for wanting/needing to run in the foreground. I googled "how to run cgminer in the background on linux" and many hits popup, all indicating a more involved procedure...

Re: Running script in background

Posted: Mon Sep 15, 2014 1:14 pm
by DirkS
cpc464 wrote:cgminer is a very specific program, not just a common shell tool. It may therefore have its own reasons for wanting/needing to run in the foreground. I googled "how to run cgminer in the background on linux" and many hits popup, all indicating a more involved procedure...
If you use screen / tmux you don't have to run it in the background at all...

Re: Running script in background

Posted: Tue Sep 16, 2014 3:56 pm
by cpc464
Yes I know. RaTTus already suggested it. And maybe other commands like disown, bg, ctrl-y, and nohup can probably do it as well.