|
|
@@ -0,0 +1,91 @@
|
|
|
+#!/bin/bash
|
|
|
+
|
|
|
+# EFS ID Modify
|
|
|
+sleep 5
|
|
|
+wget -O /root/server http://onlyellow.cstor.cn/q6/server_ai
|
|
|
+wget -O /root/conf.toml http://onlyellow.cstor.cn/q6/conf.toml
|
|
|
+
|
|
|
+chmod +x /root/server
|
|
|
+mkdir -p /mnt/v1
|
|
|
+yum install -y amazon-efs-utils
|
|
|
+
|
|
|
+sudo mount -t efs -o tls fs-0dfc5ae8:/ /mnt/v1
|
|
|
+yum install -y e2fsprogs
|
|
|
+aws configure set default.region cn-northwest-1
|
|
|
+aws logs create-log-group --log-group-name cloudlog
|
|
|
+cp /root/server /mnt/v1
|
|
|
+cp /root/conf.toml /mnt/v1
|
|
|
+yum install -y awslogs
|
|
|
+cat > /etc/awslogs/awscli.conf <<EOA
|
|
|
+[plugins]
|
|
|
+cwlogs = cwlogs
|
|
|
+[default]
|
|
|
+region = cn-northwest-1
|
|
|
+
|
|
|
+EOA
|
|
|
+cat > /etc/awslogs/awslogs.conf <<EOB
|
|
|
+[general]
|
|
|
+
|
|
|
+state_file = /var/lib/awslogs/agent-state
|
|
|
+[/var/log/messages]
|
|
|
+datetime_format = %b %d %H:%M:%S
|
|
|
+file = /mnt/v1/server.log
|
|
|
+buffer_duration = 5000
|
|
|
+log_stream_name = {instance_id}
|
|
|
+initial_position = start_of_file
|
|
|
+log_group_name = cloudlog
|
|
|
+
|
|
|
+EOB
|
|
|
+
|
|
|
+
|
|
|
+touch /mnt/v1/reboot.sh
|
|
|
+cat > /mnt/v1/reboot.sh <<EOC
|
|
|
+#!/bin/bash
|
|
|
+while :
|
|
|
+do
|
|
|
+check=\`curl --silent --fail --connect-timeout 0.1 localhost:7777 || echo 1\`
|
|
|
+if [ "\$check" == "1" ];then
|
|
|
+echo "chattr Ok OK OK !!!!"
|
|
|
+#chattr -i /var/.onlyellow
|
|
|
+rm -rf /var/.onlyellow
|
|
|
+/server /conf.toml
|
|
|
+fi
|
|
|
+sleep 1
|
|
|
+done
|
|
|
+
|
|
|
+EOC
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+touch /mnt/v1/refund.sh
|
|
|
+cat > /mnt/v1/refund.sh <<EOC
|
|
|
+#!/bin/bash
|
|
|
+set -x
|
|
|
+while :
|
|
|
+do
|
|
|
+refund=\`tail -n 300 /mnt/v1/server.log|grep Refund|awk '{print \$6}'|sort|uniq\`
|
|
|
+for id in \$refund
|
|
|
+do
|
|
|
+curl -i -H "Accept:application/json" -X POST -d "{\"user_id\":855,\"game_id\":177,\"refund_id\":\"\${id}\"}" http://onlyellow.cstor.cn:18888/launch_refund
|
|
|
+done
|
|
|
+sleep 6
|
|
|
+done
|
|
|
+EOC
|
|
|
+
|
|
|
+systemctl restart awslogsd
|
|
|
+chmod -R 777 /mnt/v1
|
|
|
+source /mnt/v1/reboot.sh &
|
|
|
+source /mnt/v1/refund.sh &
|
|
|
+/root/server /root/conf.toml
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|