How can ffmpeg auto-stop on input loss from an RTSP stream?

Is it possible to configure ffmpeg, which is hosted on a VPS to convert RTSP to HLS and served via Apache, to automatically terminate its process if it stops receiving input from the -i address? This setup involves an IP camera in a different location streaming RTSP video to the VPS through a computer acting as a re-streamer. While the HLS stream functions well, being stable and fast, issues arise if the connection between the re-streamer and VPS is lost, necessitating a manual restart of the ffmpeg instance via SSH. I already have a bash script ready to auto-restart the process. For clarification, I’m aware that ffmpeg’s timeout flag requires values in microseconds, whereas listen_timeout uses seconds, a detail that has been a point of confusion in various discussions.