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

<p>Doing </p>

<pre><code>su user_running_the_x_session -c "/home/user/mine.sh"
</code></pre>

<p>worked perfectly.</p>

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

CC BY-SA 3.0
2014-03-01T08:09:04.393Z
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
CC BY-SA 3.0
2014-03-03T07:39:48.100Z
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
CC BY-SA 3.0
2014-03-14T09:25:23.067Z
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
CC BY-SA 3.0
2014-02-28T19:56:08.687Z
2014-02-28T19:56:08.687Z
user2991576
<p>I trying to script the launch of cgminer based on a crontab.</p>

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

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

<p>The entry is in the crontab accessible when being (sudo -s).</p>

<p>Any clues on what could be wrong ?</p>

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

<p>The script launches cgminer with a basic cmd : </p>

<pre><code>cd dir_where_cgminer_is_stored 
./cgminer -c /folder/myconfig.conf
</code></pre>

<p>Thanks</p>

CC BY-SA 3.0
2014-02-28T14:07:00.310Z
I guess you should be logged in and Xserver should be started before you can start cgminer.
Art Shayderov
CC BY-SA 3.0
2014-02-28T14:08:37.523Z
Crontab is usually used for repeated jobs
Art Shayderov
CC BY-SA 3.0
2014-02-28T19:58:00.603Z
Thanks pyramids, I didn't know root cannot use another user's X session.
user2991576
<cgminer><linux><ubuntu>
Issue running cgminer from crontab
user2991576
# Issue running cgminer from crontab

(Asked by: username_0 on 2014-02-28)

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

**Tags:** cgminer, linux, ubuntu

> **Comments:**
> **username_1**: I guess you should be logged in and Xserver should be started before you can start cgminer.  
> **username_1**: Crontab is usually used for repeated jobs  
> **username_0**: Thanks pyramids, I didn't know root cannot use another user's X session.  

---

## 1 answers

### Answer by username_0 on 2014-02-28. Score: 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 username_1, yes, cron is used for repeated jobs, like for example the one I am talking about here ;)

> **Comments:**
> **username_1**: 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.  
> **username_0**: 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.  
> **username_1**: 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.  

---

