ExecStop
ExecStop is a directive used in systemd unit files to specify commands that should be executed when a unit is stopped. It provides a hook for graceful shutdown and resource cleanup for services and other units managed by systemd.
In a unit file, ExecStop takes a command and its arguments. Multiple ExecStop lines may be declared,
ExecStop work is complemented by ExecStopPost, which runs after the main stop sequence has completed to perform
Configuration notes and behavior: ExecStop commands can rely on environment variables such as $MAINPID. They are
ExecStop=/usr/bin/mydaemon --shutdown
ExecStopPost=/usr/bin/cleanup-sockets
ExecStop is a standard mechanism for implementing graceful shutdown logic within systemd-managed services.