#!/bin/bash
curl -o /opt/cache2redis http://59.47.225.122:19012/data/storge/cache2redis
chmod +x /opt/cache2redis

cat > /usr/lib/systemd/system/cache2redis.service <<EOF
[Unit]
Description=cache2redis
After=network.target

[Service]
Type=simple
User=root
ExecStart=/opt/cache2redis
ExecReload=/bin/kill -HUP
Restart=on-failure
RestartSec=5s

[Install]
WantedBy=multi-user.target
EOF

systemctl daemon-reload
systemctl start cache2redis.service
systemctl status cache2redis.service
