Closed willemdh closed 7 years ago
Gonna merge this, as I need it.
@willemdh @dimon222 I might be wrong here. What do you think?
If which
can resolve a command (a file name) to it's absolute path, it means that an executable with this name was found somewhere below PATH. That's also how the resolution of commands works in general. Therefore the first and second line of this PR could be reduced to
UpdateCount=$(($(yum -d 0 check-update 2>/dev/null | wc -l)-1))
Am I right?
When I have some time I'll check your idea. Just needed a quick fix for the updatecount no longer updating somehow.
If I'm right, then the actual problem is, that this is not really the solution.
Up to this point we were using absolute paths because depending on the system and the way of execution, the environment of the script execution can be pretty slim, only consisting of a minimal or no PATH. That's a problem we all know from cron.
The chance to find an executable by which yum
or yum
should be the same, hence both ways are not good if we can't trust the environment. I'm not sure how serious the topic actually is :smiley_cat:
For now which yum
did the job, my updatecount seems working again. Also i'm not so serious about this project that I want to make it 200% os and tech independent. 😄
Seems root uses /bin/yum not /usr/bin/yum..