Skip to content

Commit

Permalink
update startup script
Browse files Browse the repository at this point in the history
  • Loading branch information
inada-s committed May 3, 2020
1 parent 10bcdf9 commit c81ae13
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions infra/mcsfunc/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,19 @@ if grep -xqFe 'ubuntu ALL=NOPASSWD: /sbin/shutdown' /etc/sudoers; then
echo 'ubuntu ALL=NOPASSWD: /sbin/shutdown' >> /etc/sudoers
fi
cat << 'EOF' > /etc/google-fluentd/config.d/gdxsv.conf
<source>
@type tail
format json
path /var/log/gdxsv.log
pos_file /var/lib/google-fluentd/pos/gdxsv.pos
read_from_head true
tag gdxsv-mcs
</source>
EOF
sudo systemctl restart google-fluentd
cat << 'EOF' > /home/ubuntu/launch-mcs.sh
#!/bin/bash -eux
Expand Down Expand Up @@ -84,12 +97,15 @@ export GDXSV_LOBBY_PUBLIC_ADDR=zdxsv.net:9876
export GDXSV_BATTLE_ADDR=:9877
export GDXSV_BATTLE_REGION=$(basename $(curl -s -H "Metadata-Flavor: Google" http://metadata.google.internal/computeMetadata/v1/instance/zone))
export GDXSV_BATTLE_PUBLIC_ADDR=$(curl -s https://ipinfo.io/ip):9877
$TAG_NAME/bin/gdxsv mcs
touch /var/log/gdxsv-mcs.log
truncate -s0 /var/log/gdxsv-mcs.log
$TAG_NAME/bin/gdxsv -prodlog mcs 2>&1 > /var/log/gdxsv-mcs.log
EOF
chmod +x /home/ubuntu/launch-mcs.sh
su ubuntu -c 'cd /home/ubuntu && nohup ./launch-mcs.sh 2>&1 | logger &'
su ubuntu -c 'cd /home/ubuntu && nohup ./launch-mcs.sh &'
echo "startup-script done"
`
}
Expand Down

0 comments on commit c81ae13

Please sign in to comment.