systemd - define a service without ExecStop and be able to stop it without "fail"
0
votes
2
answers
4954
views
I am with CentOS 7, and I want to start Kafka standalone producer (File Connector) as a service. The command is:
/opt/kafka/bin/connect-standalone.sh /opt/kafka/config/connect-standalone.properties /opt/kafka/config/connect-file-source.properties
And, obviously, it has no stop command. Normally, I just Ctrl+C to stop it as a foreground process.
But when I test, I found very tedious to open several terminal console session to run several processes (Zookeeper, Kafka server, Kafka producer, Storm jar, etc.) so I change Zookeeper and Kafka server as service, which have their
stop
script. But in this case, no.
I tried systemctl start kafka-producer
and systemctl stop kafka-producer
, but the service entered failed
status, and is not stopped. I had to delete the service, reload the daemon, and switch to manual again.
kafka-producer.service
:
[Unit]
Description=Kafka Producer
After=network.target
[Service]
Type=simple
ExecStart=/opt/kafka/bin/connect-standalone.sh /opt/kafka/config/connect-standalone.properties /opt/kafka/config/connect-file-source.properties
Restart=on-abort
[Install]
WantedBy=default.target
Anyway to manipulate a service without ExecStop
command?
Asked by WesternGun
(538 rep)
Feb 23, 2018, 08:11 AM
Last activity: Nov 5, 2021, 07:39 AM
Last activity: Nov 5, 2021, 07:39 AM