[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: service vs systemctl



I accidentally deleted a sentence in my last reply, here's the
corrected version...

On Tue, 2023-03-07 at 15:38 +0800, Ken Young wrote:
> Hello
> 
> For debian 11, service is just a wrapper to systemctl, is it right?

It's a 217 line shell script and looking at it it checks for which init
system is in use. So if you have systemd (Debian's default now) then
yes, it will call systemctl.

> So for server management, both commands below have the same results.
> 
> sudo service nginx start
> sudo systemclt start nginx
> 

They may not be the same, e.g. under the section of the script dealing
with both stop and start is this comment

# Follow the principle of least surprise for SysV people:
# When running "service foo stop" and foo happens to be a service that
# has one or more .socket files, we also stop the .socket units.
# Users who need more control will use systemctl directly.

Personally, I still use 'service' through habit and won't change until
it doesn't do what I expect.



Reply to: