0

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.

balanv
  • 10,686
  • 27
  • 91
  • 137

2 Answers2

0

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;

Devon
  • 5,786
  • 5
  • 38
  • 46
  • I tried to print `whoami` into log, it shows `root` user. Ok, i will try printing error log. – balanv Sep 11 '14 at 14:04
  • It shows like `Error opening terminal: unknown.`, i tried to execute cgminer with command `/root/test/cgminer/cgminer/cgminer -T`, it showed the default logs as like when started with Terminal.. but the command is not showing up when i type `ps -A` – balanv Sep 12 '14 at 07:01
  • Thank you very much Devon! I have found a solution with the debugging step you have provided. – balanv Sep 12 '14 at 12:07
0

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 
balanv
  • 10,686
  • 27
  • 91
  • 137