How stop systemd service
You need to put in a ExecStop
option in the [Service]
section with the command you want to use to stop the service.
Something like:
[Service]
Environment=FLUME_CLASSPATH=/opt/flume/current/lib/
ExecStart=/usr/bin/nohup /usr/bin/flume-ng agent -c /etc/flume-ng/conf -f /etc/flume-ng/conf/flume.conf --name a1 &
ExecStop=/usr/bin/flume-ng agent stop
or whatever the command is to stop the flume-ng
Then you can stop the service with systemctl stop flume-ng
.
Read the manual at https://www.freedesktop.org/software/systemd/man/systemd.service.html for the full set of options available to control the service.
You can just execute systemctl stop flume-ng.service
. When executed, the default action is sending SIGTERM
to the main process and wait until a configurable time to see if the processes has been terminated. If the process doesn't terminate, then systemd sends SIGKILL
signal which does the job. If the main process has forked off other processes, systemd will take them down too since they all live in the same cgroup.
You do not need to have ExecStop=
directive unless you have a different way of shutting down your service.