设置mysql nginx开机自启
一.mysql
1.先--list看下启动级别
[root@localhost etc]# chkconfig --list mysqld Note: This output shows SysV services only and does not include native systemd services. SysV configuration data might be overridden by native systemd configuration. If you want to list systemd services use 'systemctl list-unit-files'. To see services enabled on particular target use 'systemctl list-dependencies [target]'. mysqld 0:on 1:on 2:on 3:on 4:on 5:on 6:on
2.随后添加off为on
chkconfig --level 016 mysqld on
二.nginx
1.先进入此目录下
[root@localhost etc]# cd /lib/systemd/system
2.创建nginx.service文件并添加以下内容
[Unit] Description=nginx service After=network.target [Service] Type=forking ExecStart=/nginx/sbin/nginx ExecReload=/nginx/sbin/nginx -s reload ExecStop=/nginx/sbin/nginx -s quit PrivateTmp=true [Install] WantedBy=multi-user.target
3.设置nginx为开机自启
[root@localhost system]# systemctl enable nginx