Re: Correct way to stop fetchmail
On Sat, Dec 28, 2024 at 17:21:08 +0100, Roger Price wrote:
> ● fetchmail.service - LSB: init-Script for system wide fetchmail daemon
The correct way to stop a systemd service whose name you know is:
systemctl stop fetchmail.service
If you're entirely new to systemd, you can get by with:
systemctl status NAME # looks like you found that
systemctl stop NAME # terminate a running service
systemctl start NAME # start a stopped service
systemctl restart NAME # stop, and then start, a running service
systemctl reload NAME # ask a running service to reread configs
Not all services have a "reload" option, but many do.
Quite often, discovering the service's systemd unit name is the hardest
part in managing it.
> It's dead, but still fetching mail!
If the service is showing as terminated, but it continues running
intermittently, then it's *possible* that something else is invoking
it. In that case, you will have some detective work to do. But let's
not go down that rabbit hole if it's just a matter of you not knowing
how to stop a service.
> I tried
>
> root@titan ~ /etc/init.d/fetchmail --quit
> Not starting fetchmail daemon, disabled via /etc/default/fetchmail.
The correct way to use a legacy sysv-rc init.d script to stop a service
is:
/etc/init.d/fetchmail stop
But if you already know there's a systemd unit, you should use the
systemctl way instead. The init.d scripts are remnants of a past
init system. If you're not actually *using* that init system, you
shouldn't get in the habit of relying on its legacy shims to be there.
In this specific case, the --quit option you tried to use was ignored,
and it appears to have assumed you meant "start". But it DID NOT
start the fetchmail service, because it's disabled in the
/etc/default/fetchmail file. (The /etc/default/ directory is the
common place for configuration files used by sysv-rc scripts.)
All of this is just background noise, though. You shouldn't be using
this init.d script when there's a systemd unit file.
Reply to: