redis开机自启

cat <<'EOF'> /usr/lib/systemd/system/redis.service 
[Unit]
Description=Redis persistent key-value database
After=network.target

[Service]
ExecStart=/usr/bin/redis-server /etc/redis.conf --supervised systemd
#ExecStop=/usr/libexec/redis-shutdown # 不设置这一行也可以stop
Type=notify
#User=redis
#Group=redis
RuntimeDirectory=redis
RuntimeDirectoryMode=0755

[Install]
WantedBy=multi-user.target
EOF
posted @ 2022-01-28 20:14  1769987233  阅读(37)  评论(0编辑  收藏  举报