systemd 常规操作

开机启动unit
systemctl enable postfix.service
增加由/usr/lib/systemd/system/到/etc/systemd/system/multi-user.target.wants/下的软链接
ln -s '/usr/lib/systemd/system/postfix.service' '/etc/systemd/system/multi-user.target.wants/postfix.service'

开机不启动unit
systemctl disable httpd.service
删除/etc/systemd/system/multi-user.target.wants下的软链接

查看开机是否启动
systemctl is-enabled .service #查询服务是否开机启动

systemd查看开机自启动的程序
相当于chkconfig --list
ls /etc/systemd/system/multi-user.target.wants/

查看systemd单元加载及活动情况
systemctl

显示启动失败的单元
systemctl --failed

查看systemd管理的所有单元
systemctl list-unit-files

服务管理

=================================================
启动服务
systemctl start httpd.service
关闭服务
systemctl stop httpd.service
重启服务
systemctl restart httpd.service
重新加载
systemctl reload httpd.service
查看状态
systemctl status httpd.service

你可能感兴趣的:(systemd 常规操作)