Electronically verify whether cable is connected to RJ45 connector
Depending on the transceivers you have you might be able to go with something like these:

http://www.ti.com/lit/an/slyt257/slyt257.pdf

https://www.renesas.com/eu/en/www/doc/application-note/an1593.pdf

It seems you don't, but if you had full access to modify both sides you could also try something even easier:

https://stackoverflow.com/questions/25232237/is-it-possible-to-know-the-connection-status-of-a-rs232-port