Skip to content

Instantly share code, notes, and snippets.

@patrickmaciel
Created April 11, 2016 12:01
Show Gist options
  • Save patrickmaciel/82f516cdf56aa8fd2616361bc14b4db4 to your computer and use it in GitHub Desktop.
Save patrickmaciel/82f516cdf56aa8fd2616361bc14b4db4 to your computer and use it in GitHub Desktop.
Git hook SSH another EC2 server
#!/bin/sh
unset $(git rev-parse --local-env-vars)
echo ''
echo '[SSH] Connecting in site.iab.hml...'
ssh -i /home/ubuntu/.ssh/ANOTHER_SERVER_PEM.pem ubuntu@IP_FROM_ANOTHER_SERVER <<'ENDSSH'
echo '[IN] Connected!'
echo '[IN] Listing directories...'
to
ls -liah
echo '[IN] Listed!'
echo '[IN] Exiting...'
exit
echo '[OUT] Exited!'
echo ''
echo 'Bye :)'
echo ''
ENDSSH
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment