I want to delete a route in case it exists.
My script is:
if ip route | grep "18.104.22.168/8 dev ipsec0"
ip route del 22.214.171.124/8 dev ipsec0
logger -i -t myscript -- deleted
logger -i -t myscript -- not deleted
I'm running this every 10 minutes with a cronjob.
Even if the route exists it tells me "not deleted".
If I run the script from the command line it deletes the route.
Any ideas why?