You can switch over the active HSRP role by increasing the priority on the secondary router, as long as preemption is enabled. With regards to BGP, it is not quite clear what your issue is. Do you want to make sure that secondary router starts advertising your prefixes when you switch it to take over HSRP active role? That depend on what you are advertising over BGP. If your prefixes are the same from both routers and you use as-path prepending to select the active one, then I guess you can modify your policy to prefer secondary router. If your WAN circuits are with different providers and the BGP prefixes you advertise are different, then you don't need to do that. If you could clarify what exactly you need to do and provide a simple diagram, that would help
Thanks for your answer.
My doubt is more to know if there is any command within the bgp.
let's say I was thinking about these:
no neighbor 10.31.22.49 remote-as 666
no synchronization bgp
thing that when executing the command SHOW IP INT SUMMARY see how long the bgp has fallen and in that way the link backup will go to main.
What you can do to decrease the convergence time is to use the IP SLA tracking. You can set the SLA tracking objects to monitor the reachability of a remote IP address reachable via your BGP routes on the primary router. Then set up the HSRP decrement in case this object goes down. Then once you remove your BGP neighbour, the routes clear and SLA fails. As soon as SLA monitor fail, HSRP decreases the priority and secondary router becomes active.