Yum update script with return value
I am trying to automate yum update of specific package on a remote machine.
So far I have this:
#!/bin/bash
# Update my system
if ! yum update w3m
then
failure=1
fi
if [ $failure ]
then
echo "Could not update system." >&2
exit 1
fi
echo "Update successful"
exit 0
The script runs fine and shows:
Loading "installonlyn" plugin
Loading "security" plugin
Loading "rhnplugin" plugin
This system is not registered with RHN.
RHN support will be disabled.
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
Skipping security plugin, no data
Could not find update match for w3m
No Packages marked for Update/Obsoletion
Update successful
This is OK, but I NEED it to just return the final echo "Update successful".
How can I do this?
Thanks for all the help!
|