diff options
| author | m-chandler <mchandler89@gmail.com> | 2024-11-09 09:20:15 +1000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-09 09:20:15 +1000 |
| commit | d31e4f88b1409f2325220cd483c03e6b9bce878f (patch) | |
| tree | 425b129470914ee341655021c2034ff9476af27a /util/upload-save.bash | |
| parent | 11bdeb09d654abe2e4daa66c4315b6dc982564e6 (diff) | |
| parent | 216c660cd1a1fcbd189880548c33f7846542698e (diff) | |
Merge pull request #43 from Isaac-T-Hill/optional-ssh-keys
Add optional argument for ssh key path in utils
Diffstat (limited to 'util/upload-save.bash')
| -rw-r--r-- | util/upload-save.bash | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/util/upload-save.bash b/util/upload-save.bash index 9c66030..4cd55e8 100644 --- a/util/upload-save.bash +++ b/util/upload-save.bash @@ -9,6 +9,12 @@ fi # Get the file path and EC2 address from command line arguments save_file="$1" ec2_address="$2" +key_path="" + +# Check if custom PEM file is provided +if [ -n "$FACTORIO_PEM" ]; then + key_path="-i $FACTORIO_PEM" +fi # Check if the file exists if [ ! -f "$save_file" ]; then @@ -18,10 +24,10 @@ fi # Upload the save file to the EC2 instance echo "Uploading save file to EC2 instance..." -scp "$save_file" "ec2-user@$ec2_address:~/" +scp $key_path "$save_file" "ec2-user@$ec2_address:~/" # SSH into the EC2 instance and perform the required operations -ssh "ec2-user@$ec2_address" << EOF +ssh $key_path "ec2-user@$ec2_address" << EOF # Get the Factorio container ID container_id=\$(docker ps | grep factoriotools/factorio | awk '{print \$1}' | cut -c1-3) |
