Issue running cgminer from crontab

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

user2991576

Posted 2014-02-28T08:39:34.940

Reputation: 21

2I guess you should be logged in and Xserver should be started before you can start cgminer.Art Shayderov 2014-02-28T14:07:00.310

Crontab is usually used for repeated jobsArt Shayderov 2014-02-28T14:08:37.523

@ArtShayderov It makes sense to launch a miner during certain times (e.g. during your sleeping break).pyramids 2014-02-28T19:45:40.010

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? ...?pyramids 2014-02-28T19:50:08.197

Thanks pyramids, I didn't know root cannot use another user's X session.user2991576 2014-02-28T19:58:00.603

Answers

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 ;)

user2991576

Posted 2014-02-28T08:39:34.940

Reputation: 21

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.Art Shayderov 2014-03-01T08:09:04.393

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.user2991576 2014-03-03T07:39:48.100

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.Art Shayderov 2014-03-14T09:25:23.067