Smarted port detection and app restart order.