1. 程式人生 > 實用技巧 >centos7 redis新增開機啟動服務

centos7 redis新增開機啟動服務

vim /etc/systemd/system/redis-server.service

[Unit]
Description=The redis-server Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/redis-server /usr/local/redis/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.target

設定

1 systemctl daemon-reload
2 systemctl start redis-server.service
3 systemctl enable redis-server.servic

------------恢復內容開始------------

vim /etc/systemd/system/redis-server.service

[Unit]
Description=The redis-server Process Manager
After=syslog.target network.target

[Service]
Type=simple
PIDFile=/var/run/redis_6379.pid
ExecStart=/usr/local/redis/redis-server /usr/local/redis/redis.conf
ExecReload=/bin/kill -USR2 $MAINPID
ExecStop=/bin/kill -SIGINT $MAINPID

[Install]
WantedBy=multi-user.target

設定

1 systemctl daemon-reload
2 systemctl start redis-server.service
3 systemctl enable redis-server.servic

------------恢復內容結束------------