使用 systemd 配置 reids 服务 加入开机自启

使用 systemd 配置 reids 服务 加入开机自启

vim /usr/lib/systemd/system/redis.service
[Unit]
Description=redis service
After=network.target

[Service]
Type=forking
ExecStart=/bin/bash -c '/root/app/redis/redis-4.0.2/src/redis-server /root/app/redis/redis-4.0.2/redis.conf'
ExecStop=/bin/bash -c '/root/app/redis/redis-4.0.2/src/redis-cli shutdown'
Restart=always

[Install]
WantedBy=multi-user.target

 systemctl daemon-reload 
 systemctl start redis.service 
 systemctl status redis.service 
 systemctl enable redis.service