-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On Friday, 2020-12-18 at 13:19 -0300, Marco Calistri wrote:
Hello,
(Note: This is a generic Linux/Unix question not specifically related to Opensuse)
Here a weird fact I face running a cron job from /etc/cron.hourly which it looks to trim away the final part of the text I aim to get.
Below is the signature generated by script I add into the cron job:
--
Marco Calistri Build: openSUSE Tumbleweed 20201216 Kernel: 5.9.14-1-default Desktop:
Whereas here at the bottom the same script result if I run it from my console:
-- Marco Calistri Build: openSUSE Tumbleweed 20201216 Kernel: 5.9.14-1-default Desktop: (Xfce 4.14) <----------------As you can see the script ran by the cron job it is missing this part.
I suppose it could be caused by some variables settings which are different from my user environment and the ones used by the cron user.
This is the script I use:
#!/bin/sh echo "Marco Calistri" > /home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt echo "Build: $(head -n 1 /etc/issue|awk -F'to' '{print $2}'|awk -F'-' '{print $1}')" >> /home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt echo "Kernel: $(uname -r)" >> /home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt echo "Desktop:$(xfce4-session --version |awk -F'xfce4-session' '{print $2}'|awk -F'2' '{print $2}')" >> /home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt echo -ne "\n" >> /home/marco/.thunderbird/cy71896h.Marco/signatures/os-release.txt
Thanks for any eventual suggestion you could provide to me.
When I run the last but one line in my terminal I get: cer@Telcontar:~> echo "Desktop:$(xfce4-session --version |awk -F'xfce4-session' '{print $2}'|awk -F'2' '{print $2}')" Desktop:.1 (Xfce 4.1 cer@Telcontar:~> which is not what you say you get. I tried also as root, as your cronjob runs as root: Telcontar:~ # echo "Desktop:$(xfce4-session --version |awk -F'xfce4-session' '{print $2}'|awk -F'2' '{print $2}')" Desktop:.1 (Xfce 4.1 Telcontar:~ # I I run tests to try to see what sections of that line produce, they fail on me. As I can not read awk, I can't do much. But I can produce the same result. cer@Telcontar:~> xfce4-session --version | grep xfce4-session | cut -d" " -f3,4 (Xfce 4.12) cer@Telcontar:~> echo -n "Desktop: " >> file echo "xfce4-session --version | grep xfce4-session | cut -d" " -f3,4" >> file or VERSION=`xfce4-session --version | grep xfce4-session | cut -d" " -f3,4"` echo "Desktop: $VERSION" >> file or VERSION=`xfce4-session --version | head -1 | cut -d" " -f3,4` echo "Desktop: $VERSION" >> file - -- Cheers, Carlos E. R. (from openSUSE 15.1 x86_64 at Telcontar) -----BEGIN PGP SIGNATURE----- iHoEARECADoWIQQZEb51mJKK1KpcU/W1MxgcbY1H1QUCX90CVhwccm9iaW4ubGlz dGFzQHRlbGVmb25pY2EubmV0AAoJELUzGBxtjUfVUWgAnja5O+Yp7OI88LU9YTjG bmELnhU9AKCOpv47+2U4E/O1JaocLyYsh6rl6g== =sxFb -----END PGP SIGNATURE-----