calling aticonfig from with in a crontab script

Joined: 2 Jan 13
Posts: 1,709
Credit: 1,454,545,783
RAC: 4,374
Topic 197629

This caused me some annoyance today. I wanted to get the AMD GPU temp from a crontab Perl script on a Linux box running Ubu 14.04. The crontab was under a normal user, i.e., not root. This became a bit of a pain because something like the following failed:

----cut here ------

#!/usr/bin/perl -w
my $current_temp = `aticonfig --odgt | grep Temperature | grep C`;

----cut here -----

the above failed with this error:
ERROR - X needs to be running to perform AMD Overdrive(TM) commands

to fix this all that was require was "DISPLAY=:0" in the aticonfig call above so that it looked like:

my $current_temp = `DISPLAY=:0 aticonfig --odgt | grep Temperature | grep C`

Maybe this will help out someone else.