I tried the fix here: systemd not restarting my process and that didn't work for me.
I have a Kafka exporter for Prometheus. I have Kafka running on the same computer. When I stop Kafka, the Kakfa exporter dies (it depends on being able to communicate with the Kafka processes). I would like the exporter to automatically restart after Kafka is started again, but this isn't working.
Here's my systemd file, below. I've tried various things here. What can I do to ensure the Kafka exporter starts after Kafka is finally restarted / brought back up?
[Unit]
Requires=kafka.service
After=kafka.service
[Service]
Type=simple
User=kafka
# give kafka time to start up first
ExecStartPre=/bin/sleep 15
ExecStart=/opt/kafka_exporter/kafka_exporter --kafka.server=localhost:9092
Restart=always
RestartSec=30
StartLimitInterval=0s
[Install]
WantedBy=multi-user.target