1. mysql自启动配置
-
查看mysql服务路径 # ls/usr/local/mysql/support-files/
mysqld_multi.server mysql-log-rotate mysql.server
-
将mysql.server 复制到/etc/rc.d/init.d下,并改名为mysqld # cp /usr/local/mysql/mysql/support-files/mysql.server /etc/rc.d/init.d/mysqld
-
赋值权限 # chmod +x /etc/init.d/mysqld
-
添加到自启服务 # chkconfig --add mysqld
-
查看服务列表: # chkconfig --list
-
重启查看mysql服务 # reboot
# ps -ef |grep mysql
mysql 14417 14214 0 Apr05 ? 00:02:13 /usr/local/mysql/bin/mysqld --basedir=/usr/local/mysql --datadir=/usr/local/mysql/data --plugin-dir=/usr/local/mysql/lib/plugin --user=mysql --log-error=/usr/local/mysql/data/error.log --pid-file=/usr/local/mysql/data/mysql.pid --socket=/tmpmysql.sock --port=3306
2.redis自启动配置
-
查看Redis服务信息,没有则创建 # vim /etc/systemd/system/redis.service
[Unit] Description=redis-server After=network.target [Service] Type=forking ExecStart=/usr/local/redis/bin/redis-server /usr/local/redis/bin/redis.conf PrivateTmp=true [Install] WantedBy=multi-user.target
-
systemctl 管理,重新加载服务配置文件,开启自启动 # systemctl daemon-reload
# systemctl enable redis
-
执行后反馈
Created symlink from /etc/systemd/system/multi-user.target.wants/redis.service to /etc/systemd/system/redis.service.
|