systemd
chkconfig –level 3 httpd on | systemctl enable httpd.service |
chkconfig –level 3 httpd off | systemctl disable httpd.service |
service httpd status | systemctl status httpd.service |
service httpd start | systemctl start httpd.service |
service httpd stop | systemctl stop httpd.service |
service httpd restart | systemctl restart httpd.service |
chkconfig –list | systemctl list-units –type=service |
systemctl list-units --type=service systemctl list-unit-files
for i in `systemctl list-unit-files | grep enabled | grep abrt | cut -d ‘ ‘ -f 1`; do systemctl disable $i; done
systemctl disable sshd systemctl disable postfix systemctl disable bluetooth
/etc/inittab 5 ==> 3 sudo systemctl set-default multi-user.target sudo systemctl set-default graphical.target
/usr/lib/systemd/system/: 存放 unit 的文件 /etc/systemd/system/: 开机执行的文件
systemctl disable postfix
rm ‘/etc/systemd/system/multi-user.target.wants/postfix.service‘
systemctl enable sshd
ln -s ‘/usr/lib/systemd/system/sshd.service‘ ‘/etc/systemd/system/multi-user.target.wants/sshd.service‘
cat /usr/lib/systemd/system/postfix.service
[Unit]
Description=Postfix Mail Transport Agent
After=syslog.target network.target
Conflicts=sendmail.service exim.service
[Service]
Type=forking
PIDFile=/var/spool/postfix/pid/master.pid
EnvironmentFile=-/etc/sysconfig/network
ExecStartPre=-/usr/libexec/postfix/aliasesdb
ExecStartPre=-/usr/libexec/postfix/chroot-update
ExecStart=/usr/sbin/postfix start
ExecReload=/usr/sbin/postfix reload
ExecStop=/usr/sbin/postfix stop
[Install]
WantedBy=multi-user.target