I am completely new to the linux world, so sorry for anything wrong I might say.I am trying to run a Mongo DB on a Debian 8.5 machine. When I installed the package (pre built from percona.com), I have noticed the following files:/etc/init.d/mongod (1)/lib/systemd/system/mongod.service (2)About /etc/init.d/mongodI understand that this is called (as long as it is registered via update-rc.d) at boot / in other particular system states (dont want to get technical on this, Im absorbing lots of informations and this seems less important).This is perfectly fine for me. The script does lots of initialization and finally launches the mongo daemon. It seems to have triggers for start, stop, restart, etc and as far as I understand I can trigger those with sudo service mongod <action>.About /lib/systemd/system/mongod.serviceThis file seems to do the same thing (i.e. run mongo), but with less configuration, just one line in the ExecStart parameter:[Unit]Description=MongoDB (High-performance, schema-free document-oriented database)After=time-sync.target network.target[Service]Type=forkingUser=mongodGroup=mongodPermissionsStartOnly=trueEnvironmentFile=/etc/default/mongodExecStart=/usr/bin/env bash -c /usr/bin/mongod $OPTIONS > ${STDOUT} 2> ${STDERR}PIDFile=/var/run/mongod.pid[Install]WantedBy=multi-user.targetAs far as I understand this can be triggered with sudo systemctl start mongod.I dont understand if this is called at boot or not.I dont understand why the need for two of these service files, and how can I get rid of one (possibly the one in /lib/systemd, since it is much simpler).I dont understand if theres any relation between the two.I have read that systemctl works on init.d scripts too, and in this case I dont understand which of the two files will be triggered by systemctl mongod start.I think theres some redundancy and I should choose just one of the two ways. And I want to be sure that it iscalled at bootcallable by command (like service or systemctl).Could you help me clear my mind? With the help of some comments I can probably focus and narrow down the question.
Confused about /etc/init.d and services in /lib/systemd/system
linux;systemd;init script;init.d
When you have both an init.d script, and a systemd .service file with the same name, systemd will use the service file for all operations.  I believe the service command will just redirect to systemd.  The init.d script will be ignored.Use systemd.  It's new in Debian 8, but it's the default.  Systemd service files are supposed to look simpler than init.d scripts.  You didn't mention any specific feature you need that's not supported by the systemd service.If the service file was not included, systemd would happily use the init.d script.  So the mongod package developer is telling you they think this systemd definition is better :).Look at the output of systemctl status mongod.  If the service is enabled to be started at boot time, the Loaded: line will show enabled.  Otherwise you can use systemctl enable mongod.  You can also include the option --now, and it will start mongod at the same time.