Linux common file location example description -/lib/systemd/system/ directory

Linux system structure /lib/systemd/system/ directory
This directory automatically stores the configuration location of the startup file, which generally contains XXXXX.service
such as systemctl enable supervisord.service, which
is to call the /lib/systemd/system/supervisord.service file to make supervisord starts at boot

Example: Once the supervisor was installed, after the installation and configuration was completed, it did not start up, so I had to configure it manually:

第一步:编辑新建supervisord.service

vi /lib/systemd/system/supervisord.service

第二步:添加如下内容

[Unit]
Description=Process Monitoring and Control Daemon
After=rc-local.service
[Service]
Type=forking
ExecStart=/usr/bin/supervisord -c /etc/supervisord.conf
SysVStartPriority=99
[Install]
WantedBy=multi-user.target

第三部:配置开机启动

systemctl enable supervisord.service
或者
systemctl enable supervisord


还有其他其他命令
systemctl start/restart/stop supervisor.service
验证一下是否为开机启动:
systemctl is-enabled supervisord
重新启动服务
systemctl restart supervisord
查看所有已启动的服务
systemctl list -units --type=service
停止开机自启动
systemctl disable nfs-server.service
查看服务当前状态
systemctl status nfs-server.service

Reference:
https://blog.csdn.net/binggoogle/article/details/53203991

http://man.linuxde.net/systemctl

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325595197&siteId=291194637