Skip to content

Instantly share code, notes, and snippets.

@vonschnappi
vonschnappi / get_pg_dump_rds.sh
Last active March 30, 2022 09:02
Get Postgres dump from an AWS RDS
DATABASE_HOST="DATABASE_HOST"
DATABASE_USERNAME="DATABASE_USERNAME"
PGPASSWORD="PASSWORD"
DATABASE_NAME="DATABASE_NAME"
EC2_HOST="USER@EC2_HOST"
DOWNLOAD_FOLDER="/home/user/Downloads"
ssh -i "keypair.pem" $EC2_HOST PGPASSWORD=$PGPASSWORD pg_dump -h $DATABASE_HOST -U $DATABASE_USERNAME -f dump.sql $DATABASE_NAME
if [ $? -ne 0 ]; then
echo "There was an issue connecting to the EC2 host or database"
@vonschnappi
vonschnappi / jenkins-pipeline-get-commit-message.groovy
Created January 10, 2018 12:29
Getting the commit message when running a Jenkins pipeline job
commit = sh(returnStdout: true, script: 'git log -1 --oneline').trim()
String commitMsg = ""
List commitMsgPre = commit.split(" ")
for(int i=1; i<commitMsgPre.size(); i++){
commitMsg += commitMsgPre.getAt(i) + " "
}