One of the easiest ways adjust routing for a backup link it to simply use an IP SLA.
Basic premise:
Create an SLA to track a specific IP from a specific IP. You ideally want to track from an external interface the is always going to be able to reach the tracked IP unless there is an outage.
ip sla 7
icmp-echo (IP to track) source-ip (your local interface IP)
timeout 6000
threshold 3000
frequency 30
Now you have to start your SLA.
ip sla schedule 7 life forever start-time now
Next you setup tracking of that SLA for reachability
track 7 ip sla 7 reachability
***(track 7 rtr 7 reachability) code version differences
Now for the implementation. You simply add the track statement to the route you want to be preferred and add the backup route with a worse metric.
ip route DestinationNetwork Mask NextHop track 7
example:
ip route 172.16.48.0 255.255.255.0 172.18.8.129 track 7
ip route DestinationNetwork Mask NextHop Distance
example:
ip route 172.16.48.0 255.255.255.0 10.14.32.1 200
You can get way more complicated with this, but this is a simple solution for backup links.
references:
Cisco SLAs