Author

Topic: ubuntu: cgminer as service (/etc/init.d) or as cron (Read 4354 times)

legendary
Activity: 1862
Merit: 1002
Sorry for the late update. I ended up using a wrapper script which calls mine.sh that sets the environement and launches cgminer.

In xcfe4 I added the wrapper script to the list of items run at startup and configured auto-login on boot. This works fine as long as mine.sh exports display to :0 and you add a 15 sec sleep to the front of the wrapper script. MY cgminer is configured to output to syslog and I load ths data into Splunk. Splunk provides me with email based alerting  and I can make a pretty nice graphical dashboard to monitor the box etc.

Later this week I'll see about getting an init script together to launch the wrapper script with the proper uid, etc. Once that works, I'll configure monitr to restart the service automatically. I'll need a bit more time to do this. I've been busy this week. =)
member
Activity: 112
Merit: 10
Launch cgminer via screen
sounds like THE solution! i'll give it a try and keep update.
Someone previously suggested byobu, and that's what I use.
I ll try that.

I just tried screen and it doesn't do what i want.
If i do  in the terminal
screen sh adress/to/my/script.sh
It does launch the script just like if i type sh adress/to/my/script.sh

Now when i restart the computer it seems to do nothing (not poping a terminal windows with cg miner)...



Like this:

Code:
/usr/bin/screen -A -d -m -S cgminer /path/to/cgminer -c /otherpath/to/cgminer.conf --whatever-other-parameters

Then you can bring it to the foreground later using:

Code:
screen -d -r

Then put it back into the background (aka detach) by typing CNTL-a d

legendary
Activity: 892
Merit: 1013
Launch cgminer via screen
sounds like THE solution! i'll give it a try and keep update.
Someone previously suggested byobu, and that's what I use.
I ll try that.

I just tried screen and it doesn't do what i want.
If i do  in the terminal
screen sh adress/to/my/script.sh
It does launch the script just like if i type sh adress/to/my/script.sh

Now when i restart the computer it seems to do nothing (not poping a terminal windows with cg miner)...


[EDIT] I finally get what i wanted.
I used this startup.sh script that i put on the desktop
Code:
#!/bin/sh
gnome-terminal -x sh /home/XXX/cgminer/mycgminercommand.sh

then i used the Startup Application utility of Ubuntu and linked to my  startup.sh script


Every time my computer reboot a terminal popup with cgminer inside.
legendary
Activity: 952
Merit: 1000
Launch cgminer via screen
sounds like THE solution! i'll give it a try and keep update.
Someone previously suggested byobu, and that's what I use.
legendary
Activity: 892
Merit: 1013
Launch cgminer via screen
sounds like THE solution! i'll give it a try and keep update.
-ck
legendary
Activity: 4088
Merit: 1631
Ruu \o/
Launch cgminer via screen
legendary
Activity: 892
Merit: 1013
i spend yesterday evening trying to do this ...
i actually manage to launch a basic .sh script at boot ( mkdir /test ) using the gnome-session startup program

but if instead i put cgminer blahblah it just doesn't work.
I also try init.d folder and rc.local with no more result.


Would be nice if ubuntu just start, then the terminal pop-up and cgminer starts
legendary
Activity: 1862
Merit: 1002
I had a miner setback this weekend with an incompatible motherboard. I picked up a new MB, cpu, and mem yesterday. I'm still working on this and should have something posted soon.
legendary
Activity: 1862
Merit: 1002
The post is coming by today to drop off my PSU and riser cables. So I should have something for you guys this weekend.
newbie
Activity: 48
Merit: 0
I'm planning to assemble a ubuntu based mining rig with 6 cards next week. I can post my init script, monit configs, and other setup details from that install when I do it.

Yes, please +1
legendary
Activity: 1904
Merit: 1185
notorious shrimp!
that would be great ;-) thx
legendary
Activity: 1862
Merit: 1002
do not use cron for anything like that. that's not going to work cleanly.

This is not too difficult. Start cgminer from an init script with --syslog or --sharelog options. The init script should be set to start for run levels 2345. (man update-rc.d on ubuntu for example) You should put any environment variables required to start cgminer into /etc/profile and wrap your cgminer command with:

bash -lc 'cgminer --blah --blah ---blah'

This command ensures that the program is run with a user environment and no TTY.

Another method to set environmental variables is to front load your command with the environment variables you wish to set. I've run into this when using cgminer for litecoin.

Other than that I would suggest using monit to monitor the process  and restart it when it fails. M/Monit is extremely useful as well if you want a web GUI to manage a monit agent.

If you need help with this, I'm planning to assemble a ubuntu based mining rig with 6 cards next week. I can post my init script, monit configs, and other setup details from that install when I do it.
legendary
Activity: 1904
Merit: 1185
notorious shrimp!
hi there!

i plan to automate my mining rigs.
doeas anyone installed cgminer as a linux sercice?
i have several problems with overclocking of my 7950 cards

other idea is to use cron to automatically start cgminer at system start.

thanks, bcm42
Jump to: