Using system-d:
I have 2 services (Service A and Service B). Service B needs Service A to always be running. If service A ever crashes or is stopped, Service B should also be immediately stopped until service A is restored (At which point in time service B should start back up automatically). Is there a directive that can be put into the system.d unit files to force this type of a relationship?
Use case examples:
#1 Nginx and mariaDB
Nginx always needs maria to be running. I don't want to have customers hitting against a web-server which has not DB back-end. Should maria crash, I want nginx to shutdown immediately. Should service be restored back to maria, I want nginx to spring back to life without having to manually restart the nginx process. Therefore, if there is a sporadic and temporary interruption to maria, nginx doesn't serve up bad requests and just let's other nodes in the cluster handle the web request.
#2 Openvpn and web crawler
Web crawler service depends on open vpn. It would be bad to have webcrawler be running without vpn also running. If the openvpn client service is stopped, I want the webcrawler to stop as well automatically. If the openvpn is restored, I want the webcrawler to start working again without needing to be started manually.