The CentOS 7 system has replaced the CentOS 6 RunLevel system service Management with SYSTEMD. Adding a startup item under/ETC/RC[0-6S].D cannot be performed automatically when the system starts, and you need to add a startup item through the new Systemd.unit configuration.
SYSTEMD Features
1. You can specify dependencies between the unit
2. You can control the order of execution between the unit or allow them to execute concurrently
A simple example
The function of this example is to configure a startup item via SYSTEMD
1. Create a file Myservice.service in the/usr/lib/systemd/system directory with the following contents:
[Unit] DESCRIPTION=SYSTEMD Unit demo[service]execstart=/your/path/startup.shexecstop=/your/path/ Shutdown.shremainafterexit=yes[install]wantedby=default.target
The Execstart entry specifies the command that the MyService unit executes at startup, which can be used to perform an operation or to start a service. The Execstop entry specifies the command that the MyService unit executes when it is closed, which can be used to perform some cleanup operations or to shut down the service.
2. Execute the command "SYSTEMCTL enable MyService" Enabling the startup item
3. Execute the command "systemctl start MyService" To activate the startup item
So far, MyService has been started and will be executed automatically after the next system boot.
There are several types of systemd.unit that correspond to different behaviors. The above example shows only the most basic usage of the Unit of service type, the detailed SYSTEMD function and configuration can refer to Systemd's manpage documentation.
CentOS 7 System Add Startup item