环境:
OS:Centos 7
添加redis开机自动启动
1.添加ssdb服务
vi /usr/lib/systemd/system/redis.service
文件内容如下:
[Unit]
Description=redis
After=network.target
After=syslog.target
[Install]
WantedBy=multi-user.target
[Service]
Type=forking
User=root
Group=root
ExecStart=/usr/local/services/redis/bin/redis-server /home/middle/redis/conf/6589.conf
ExecReload=
ExecStop=/usr/local/services/redis/bin/redis-cli -h 172.17.0.73 -a mypasswd -p 6589 shutdown
PrivateTmp=true
2.设置开机启动
chmod 754 /usr/lib/systemd/system/redis.service
systemctl enable redis.service
systemctl status redis.service
systemctl start redis.service
systemctl stop redis.service