#!/bin/bash
yum install -y wget curl screen make

# 安装路径
Path="/root/"
cd $Path

# 下载人人影视最新版本
wget https://downloads.laiboke.com/Soft/rrshareweb_centos7.tar.gz
tar -zxvf rrshareweb_centos7.tar.gz
cd rrshareweb
rm -rf /root/rrshareweb_centos7.tar.gz

# 建立服务 systemctl (start/stop/status/restart) renren
cat > /etc/systemd/system/renren.service <<EOF
[Unit]
Description=RenRen server
After=network.target
Wants=network.target

[Service]
Type=simple
PIDFile=/var/run/renren.pid
ExecStart=/root/rrshareweb/rrshareweb
RestartPreventExitStatus=23
Restart=always
User=root

[Install]
WantedBy=multi-user.target
EOF

# 资料
echo '默认端口是3001，可以在配置文件里面修改'
PublicIP=$(curl -4 icanhazip.com)
echo "面板地址: http://$PublicIP:3001"
echo '面板密码: 123456'
echo '配置文件: /root/rrshareweb/conf/rrshare.json'
