I'm trying to create a small procedure to check if "yum makecache fast" generates an error. For this I modified /etc/yum.repos.d/public-yum-ol7.repo and changed the URL address. For example:
[root@vm7020 ~]# yum makecache fast
ol7_UEKR3 | 554 B 00:00
http://public-yum.oracles.com/repo/OracleLinux/OL7/UEKR3/x86_64/repodata/repomd.xml: [Errno -1] ...
Trying other mirror.
Metadata Cache Created
( I simplified the output)
I'm not able to redirect the output in order to grep it:
[root@vm7020 ~]# error=`yum makecache fast | grep Errno`
http://public-yum.oracles.com/repo/OracleLinux/OL7/UEKR3/x86_64/repodata/repomd.xml: [Errno -1] ...
[root@vm7020 ~]# echo $error
I cannot even grep for "Metadata Cache Created", because it always shows, regardless whether an error occurred.
I tried other ways to redirect the output and check the status, but nothing works:
[root@vm7020 ~]# yum makecache fast > out.log
http://public-yum.oracles.com/repo/OracleLinux/OL7/latest/x86_64/repodata/repomd.xml: [Errno -1] Error ....
[root@vm7020 ~]# cat out.log
Metadata Cache Created
[root@vm7020 ~]# yum makecache fast
http://public-yum.oracles.com/repo/OracleLinux/OL7/UEKR3/x86_64/repodata/repomd.xml: [Errno -1] Error
[root@vm7020 ~]# echo $?
0
Any ideas?
Thanks!