Solved Trigger reconnect with net/mpd5 from crontab?

I am in the process of migrating the PPPoE internet connection on my router from ppp(8) to net/mpd5. One problem I could not find a solution for so far, is how to trigger a reconnect at a specific time of the day via crontab(5). With ppp(8) this is easily accomplished by running pppctl close which closes the connection after which it automatically reconnects. Sending the ppp process an INT signal should probably do the same. I tried sending the mpd5 process a USR2 signal, but that only closes the connection without reconnection. Same goes for issuing a close command via the telnet console. Redial attempts are set to infinite in the config file:
Code:
        set link max-redial 0
Is there anything else I might try? Perhaps only closing a particular layer using close <layer>? If so, which one?
I am reluctant to try how well mpd5 likes it if I send it a USR2 signal (disconnect) immediately followed by a USR1 signal (connect), and using some arbitrary pause in between that may or may not suffice/be to long also seems wrong.
 
How about service mpd5 restart ?
For one it seems like complete overkill to me, to shutdown and then restart the entire mpd5 process, when all I need is a re-negotiation/authentication of the PPPoE connection. Also it would probably make the associated network interface disappear, which could have unforeseen consequences that could necessitate reloading pf.conf(5), thereby resetting all tables to their initial state, or worse.
 
In lack of a better solution, I tested the method to send a USR2 signal followed by a USR1 signal to the mpd5 process in order to have it disconnect and then reconnect the link. As it turns out this method seems to be working better than expected. The USR1 signal is received by mpd5 slightly before the link is in a fully closed state but mpd5 seems to handle everything in order nevertheless. So I added a crontab entry that executes pkill -USR2 -F /var/run/mpd5.pid ; pkill -USR1 -F /var/run/mpd5.pid at a speciffied time to shift the forced 24hrs reconnect that ISPs here still love to impose on their customers to a fixed time of my choosing.
 
It worked, until it didn't. This morning ...
Code:
Sep  3 07:00:00 transrapid mpd[696]: [L1] rec'd signal USR1, opening                                                
Sep  3 07:00:00 transrapid mpd[696]: [L1] rec'd signal USR2, closing
... for reasons unknown, the order in which mpd5 received the two signals got mixed up, causing it to not bring the link back up after closing it. Now I inserted a sleep 1 between the two signals. Guess I'm gonna find out how well that works.
 
Back
Top