Redis开机自启配置


Redis 开机自启配置

vi /usr/lib/systemd/system/redis.service

#!/bin/sh
[Unit]
Description=Redis service
After=network.target

[Service]
Type=forking
#服务启停
ExecStart=/usr/local/bin/redis-server /home/redis/6379.conf
ExecStop=/usr/local/bin/redis-cli -a 123456 shutdown
PrivateTmp=true
[Install]
WantedBy=multi-user.target

 systemctl enable redis.service && systemctl start redis.service && systemctl stop redis.service