Results 1 to 2 of 2
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
...
- 07-29-2010 #1Just Joined!
- Join Date
- Jul 2010
- Posts
- 15
Update Script
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?
I can't use GREP, I need to echo the result.
Thanks for all the help!
- 07-30-2010 #2
Hello,
you could try something like this:
output=`yum update w3m 2>&1`
if [ "$output" != "1" ];then
echo "Could not update system." >&2
exit 1
fi
echo "Update successful"
exit 0
I hope this help you
Regards


Reply With Quote