From ad308476bd7cbb09b4a2b825d1476f9f092f3aa6 Mon Sep 17 00:00:00 2001 From: ligc Date: Mon, 8 Apr 2013 07:11:43 +0000 Subject: [PATCH] fix for bug 3471: print message if the persistent route does not exist git-svn-id: https://svn.code.sf.net/p/xcat/code/xcat-core/branches/2.8@15863 8638fb3e-16cb-4fca-ae20-7b5d299a9bcd --- xCAT/postscripts/routeop | 26 ++++++++++++++++++++------ 1 file changed, 20 insertions(+), 6 deletions(-) diff --git a/xCAT/postscripts/routeop b/xCAT/postscripts/routeop index 68dbf6cfa..9193af7b4 100755 --- a/xCAT/postscripts/routeop +++ b/xCAT/postscripts/routeop @@ -227,9 +227,16 @@ rm_persistent_route() route1="$net $gw $mask"; fi if [ -f $filename ]; then - sed -i -e s/"$route1"//g $filename - fi - echo "Persistent route \"$route\" removed from $filename." + grep "$route" $filename 2>&1 1>/dev/null + if [ $? -ne 0 ]; then # Does not exist in file + echo "Persistent route \"$route\" does not exist in $filename." + else + sed -i -e s/"$route1"//g $filename + echo "Persistent route \"$route\" removed from $filename." + fi + else + echo "Persistent route file $filename does not exist." + fi ;; ubuntu*) echo "Removing persistent route on Ubuntu is not supported yet." @@ -249,9 +256,16 @@ rm_persistent_route() route1="any net $net netmask $mask gw $gw $ifname"; fi if [ -f $filename ]; then - sed -i -e s/"$route"//g $filename - fi - echo "Persistent route \"$route1\" removed from $filename." + grep "$route" $filename 2>&1 1>/dev/null + if [ $? -ne 0 ]; then # Does not exist in file + echo "Persistent route \"$route1\" does not exist in $filename." + else + sed -i -e s/"$route"//g $filename + echo "Persistent route \"$route1\" removed from $filename." + fi + else + echo "Persistent route file $filename does not exist." + fi ;; esac else #AIX