Nginx Apache 等软件,通过使用 systemctl 来管理系统进程。
比如查看 Nginx 的进程状态:
systemctl status nginx
# output
● nginx.service - A high performance web server and a reverse proxy serverLoaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)Active: active (running) since Thu 2020-12-17 02:16:33 UTC; 2 weeks 6 days agoDocs: man:nginx(8)Main PID: 609 (nginx)Tasks: 3 (limit: 4713)Memory: 11.5MCGroup: /system.slice/nginx.service├─609 nginx: master process /usr/sbin/nginx -g daemon on; master_process on;├─610 nginx: worker process└─611 nginx: worker processDec 17 02:16:26 hongkong-morgon systemd[1]: Starting A high performance web server and a reverse proxy server...
Dec 17 02:16:33 hongkong-morgon systemd[1]: Started A high performance web server and a reverse proxy server.
使用系统级别的守护进程需要添加 service 文件。