Skip to Main Content

Infrastructure Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot redirect stdout of yum makecache in OL 7

Dude!Aug 24 2015 — edited Aug 24 2015

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!

This post has been answered by Avi Miller-Oracle on Aug 24 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 21 2015
Added on Aug 24 2015
5 comments
1,396 views