![](https://seccdn.libravatar.org/avatar/fa0683ee0d59ed0514fc69f8d51d74ab.jpg?s=120&d=mm&r=g)
On 17/10/16 18:03, John Andersen wrote:
On October 17, 2016 8:33:05 AM PDT, Bob Williams <linux@karmasailing.uk> wrote:
I have a bash script to generate the sig featured below.
#!/bin/bash
# script to generate a topical linux mailsig
SIGFILE=/home/bob/Documents/Signatures/daily.sig
: > $SIGFILE # (re)creates an empty SIGFILE
echo "Bob Williams" >> $SIGFILE echo " System: " `uname -sr` >> $SIGFILE distro=" $(head -n 1 /etc/SuSE-release)" kde=`kf5-config -v | grep KDE` Qt=`kf5-config -v | grep Qt` plasma=`kcmshell5 -v | awk '{print $2}'` echo " Distro: $distro" >> $SIGFILE echo " Desktop: $kde, $Qt and Plasma: $plasma" >> $SIGFILE exit 0
When run from my user command line it works correctly, but when I run it from my crontab, it fails to get the plasma version. So the last line of output reads:
Desktop: KDE Frameworks: 5.26.0, Qt: 5.6.1 and Plasma:
The error message returned by the system is:
QXcbConnection: Could not connect to display
I'm guessing that cron is not running in graphical environment, but not sure why that would make a difference.
Can anyone suggest a solution/workaround, please?
Cache the plasma version in a file somewhere. Realistically, how often does it change? You could ask zypper I suppose, but it seems like a lot of trouble for something nobody reads. Ever.
Thank you. I'm not really bothered if anyone reads it or not. My question was to try and understand why something works from the command line but not when run as a cronjob. Maybe I shouldn't have asked for a workaraound. -- Bob Williams System: Linux 4.4.22-1-default Distro: openSUSE 42.2 Beta (x86_64) Desktop: KDE Frameworks: 5.26.0, Qt: 5.6.1 and Plasma: 5.8.0