Issue with running cgminer as a cron job - Ubuntu

762 Views Asked by At

I have installed cgminer in my machine and could able to start it without any issues when running ./cgminer in terminal.

But for a specific feature, i am trying to invoke the cgminer from using shell script via a cron job.

1) The cgminer command executes correctly when i run the shell script 2) But it is not executing when i set the shell script as a cron job.

Below is the content in the shell script.

#!/bin/bash

export DISPLAY=:0.0
/root/test/cgminer/cgminer/cgminer >> /home/balan/temp/script/log.txt;

Please suggest.

2

There are 2 best solutions below

3
Devon On

Are you running this as a cronjob under the root user or the balan user? Since the cgminer binary is in the root directory this probably needs to run as root.

If you are running as root, try redirecting the error output and see what errors are being logged:

/root/test/cgminer/cgminer/cgminer >> /home/balan/temp/script/log.txt 2>/home/balan/temp/script/error_log.txt;

0
balanv On

Solution :

The variable TERM has to be set as like below and respective host, username and password to be given for the cgminer to execute from cronjob.

  export TERM=xterm

  #Change the below cgminer path - IMPORTANT
  /root/test/cgminer/cgminer/cgminer -o $host -u $user -p $password