Systemctl commands
To start nginx, execute the command:
#systemctl start nginx
In CentOS 7 the file "/etc/inittab" is not there. It is replaced by "/etc/systemd/system/". This is a symlink directory. This contains symlinks to files in /usr/lib/systemd/system/. This /usr/lib/systemd/system/ contains init scripts. When you enable a service to start at reboot, this create a symlink file under the location "/etc/systemd/system/multi-user.target.wants".
This can be shown with below example.
# systemctl enable [email protected]
This will create symlink as below.
#ln -s '/usr/lib/systemd/system/[email protected]' '/etc/systemd/system/multi-user.target.wants/[email protected]'
Also, it is possible to filter status of service using systemctl. The command is as below:
systemctl list-unit-files ----type=service
Also to enable nginx, execute the command:
systemctl enable nginx.service
Here type can be service/enabled/disabled/static.
Enabled -> symlink in a .wants directory.
Disabled -> it does not.
Static -> Service is missing the [Install] section in its init script, so not able to enable or disable it.
To start nginx, execute the command:
#systemctl start nginx
In CentOS 7 the file "/etc/inittab" is not there. It is replaced by "/etc/systemd/system/". This is a symlink directory. This contains symlinks to files in /usr/lib/systemd/system/. This /usr/lib/systemd/system/ contains init scripts. When you enable a service to start at reboot, this create a symlink file under the location "/etc/systemd/system/multi-user.target.wants".
This can be shown with below example.
# systemctl enable [email protected]
This will create symlink as below.
#ln -s '/usr/lib/systemd/system/[email protected]' '/etc/systemd/system/multi-user.target.wants/[email protected]'
Also, it is possible to filter status of service using systemctl. The command is as below:
systemctl list-unit-files ----type=service
Also to enable nginx, execute the command:
systemctl enable nginx.service
Here type can be service/enabled/disabled/static.
Enabled -> symlink in a .wants directory.
Disabled -> it does not.
Static -> Service is missing the [Install] section in its init script, so not able to enable or disable it.