Skip to content

Instantly share code, notes, and snippets.

@mitsuhirookuno
Last active December 20, 2019 02:39
Show Gist options
  • Save mitsuhirookuno/0968e0c4ff78106d8f0482ccfbe0bbf4 to your computer and use it in GitHub Desktop.
Save mitsuhirookuno/0968e0c4ff78106d8f0482ccfbe0bbf4 to your computer and use it in GitHub Desktop.
InsertSubmittedDataLocal.sh の新しいやつです
#!/bin/sh
private_key_path=$1
insert_file_path=$2
environment_path=$3
if [ ${environment_path} = '/home/ec2-user/circuit-x-batch-dev' ]; then
echo '[[[ 開発環境に向いています ]]]'
batch_server_ip_address=3.112.22.21
else
echo '*** 本番環境に向いています ***'
batch_server_ip_address=52.68.207.130
fi
environment_path='/home/ec2-user/circuit-x-batch'
# 入稿データtsvを一時的にサーバ側へアップロード
scp -i ${private_key_path} -r ${insert_file_path} ec2-user@${batch_server_ip_address}:${environment_path}/cakephp/app/tmp/submitted_data/data.tsv
# サーバー側の環境構築
echo '
sh '${environment_path}'/shells/InsertSubmittedDataRemote.sh "'${environment_path}'"
' > script.sh
ssh -i ${private_key_path} ec2-user@${batch_server_ip_address} 'bash -s' < script.sh
rm -rf script.sh
@shotahirao
Copy link

LGTM です!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment