spinner
Posts: 1
Joined: Mon Sep 15, 2014 8:55 am

Running script in background

Mon Sep 15, 2014 9:01 am

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.

User avatar
RaTTuS
Posts: 10559
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK
Contact: Twitter YouTube

Re: Running script in background

Mon Sep 15, 2014 12:01 pm

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
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

cpc464
Posts: 239
Joined: Tue Jul 08, 2014 5:10 pm
Contact: Website

Re: Running script in background

Mon Sep 15, 2014 12:40 pm

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...
Unix engineer since 1989

DirkS
Posts: 10362
Joined: Tue Jun 19, 2012 9:46 pm
Location: Essex, UK

Re: Running script in background

Mon Sep 15, 2014 1:14 pm

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

cpc464
Posts: 239
Joined: Tue Jul 08, 2014 5:10 pm
Contact: Website

Re: Running script in background

Tue Sep 16, 2014 3:56 pm

Yes I know. RaTTus already suggested it. And maybe other commands like disown, bg, ctrl-y, and nohup can probably do it as well.
Unix engineer since 1989

Return to “Troubleshooting”