1. New features of SYSTEMd
Process (start) all services in parallel.
Service control logic based on dependency definition
System state snapshot
Activate the process on demand, only when it is accessed for the first time can it really start;
2. Common unit types of SYSTEMd
target: simulate the implementation level;
service: define system services;
Mount: defines the mount point of the file system;
Device: defines the device recognized by the kernel;
Socket: identify the socket file used for inter process communication;
Snapshot: manage system snapshot;
Swap: identify the swap device;
automount: file system auto mount point setting;
path: define files and directories in the file system;
3. Compile and install nginx, and use systemd to manage nginx
[Allen@centos7 ~]$ tar xf nginx-1.8.1.tar.gz [Allen@centos7 ~]$ cd nginx-1.8.1/ [Allen@centos7 nginx-1.8.1]$ sudo ./configure --prefix=/usr/local/nginx1.8.1 --with-http_ssl_module [Allen@centos7 nginx-1.8.1]$ make && make install [root@centos7 ~]# cat /etc/systemd/system/nginx.service [Unit] Description=nginx server daemon Documentation=man:nginx(8) After=network.target [Service] Type=forking ExecStart=/usr/local/nginx1.8.1/sbin/nginx ExecReload=/usr/local/nginx1.8.1/sbin/nginx -s reload ExecStop=/usr/local/nginx1.8.1/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target [root@centos7 ~]# systemctl daemon-reload [root@centos7 ~]# systemctl enable nginx.service [root@centos7 ~]# systemctl start nginx.service [root@centos7 ~]# systemctl status nginx.service ● nginx.service - nginx server daemon Loaded: loaded (/etc/systemd/system/nginx.service; enabled; vendor preset: disabled) Active: active (running) since Fri 2018-11-02 09:59:09 CST; 4min 15s ago Docs: man:nginx(8) Main PID: 7893 (nginx) CGroup: /system.slice/nginx.service ├─7893 nginx: master process /usr/local/nginx1.8.1/sbin/nginx ├─7904 nginx: worker process ├─7905 nginx: worker process ├─7906 nginx: worker process ├─7907 nginx: worker process └─7908 nginx: worker process Nov 02 09:59:09 centos7.4 systemd[1]: Starting nginx server daemon... Nov 02 09:59:09 centos7.4 systemd[1]: Started nginx server daemon. Nov 02 09:59:43 centos7.4 systemd[1]: Reloaded nginx server daemon.