0

I trying to script the launch of cgminer based on a crontab.

Using a crontab entry that fires up a bash shell script that launches cgminer. Running the script directly launches cgminer flawlessly. Running the script from crontab always give the "no gpus usable" error.

I have triple checked that all vars are set (DISPLAY, GPU_MAX_ALLOC_PERCENT, GPU_USE_SYNC_OBJECTS=1), that the paths are correct, etc.

The entry is in the crontab accessible when being (sudo -s).

Any clues on what could be wrong ?

Again, drivers and SDK are installed correctly as everything works correctly when I launch the script manually.

The script launches cgminer with a basic cmd :

cd dir_where_cgminer_is_stored 
./cgminer -c /folder/myconfig.conf

Thanks

5
  • 2
    I guess you should be logged in and Xserver should be started before you can start cgminer. Feb 28, 2014 at 14:07
  • Crontab is usually used for repeated jobs Feb 28, 2014 at 14:08
  • @ArtShayderov It makes sense to launch a miner during certain times (e.g. during your sleeping break).
    – user6049
    Feb 28, 2014 at 19:45
  • Have a look at cron's documentation (manpage?) and find its logging. Chances are it has trouble talking to the X server or some other user-/permission-related issue, in which case you will likely see an error message that will point you in the right direction. To go out on a limb: Does cron launch it as a user with permissions to access /folder/myconfig.conf? Does that user have access to X using your DISPLAY environment variable? Is cron really using the environment variables you have set up for launching your shell commands? Is a shell indeed launched to execute them? ...?
    – user6049
    Feb 28, 2014 at 19:50
  • Thanks pyramids, I didn't know root cannot use another user's X session. Feb 28, 2014 at 19:58

1 Answer 1

1

Actually, I forgot to start cgminer with the user running X (being autologged in).

Doing

su user_running_the_x_session -c "/home/user/mine.sh"

worked perfectly.

BTW Art Shayderov, yes, cron is used for repeated jobs, like for example the one I am talking about here ;)

3
  • Oh, right. I'm using dedicated rigs myself and it's really hard to look from another person's/usecase viewpoint. I was thinking "Why would someone want to switch his rig on and off?". Now I see. It's not a dedicated rig. Mar 1, 2014 at 8:09
  • Actually it is a dedicated rig. But I am running a cron to periodically check if cgminer is running, relaunch it if needed, and download new settings from a server when they change. Mar 3, 2014 at 7:39
  • If this is a dedicated rig why check cgminer periodically? Why not have a background process montitoring cgminer at all times? Are you trying to save CPU cycles? I'm piping the output of "tail -f cgminer.log" to ruby script. I'm not saying this is ideal, but tail -f uses inotify on linux and is pretty efficient, if that's your concern. Mar 14, 2014 at 9:25

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.