Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
redash_backup
node {
stage('dump redash postgre') {
sh '''
cid=`/usr/local/bin/docker ps | grep redash_postgres | /usr/bin/awk '{print $1}'`
if [ -z "${cid}" ]
then
return 1;
else
ts=`date +%Y%m%d`
/usr/local/bin/docker exec ${cid} /bin/bash -c 'pg_dump -U postgres postgres | gzip > /usr/local/redash.gz'
/usr/local/bin/docker cp ${cid}:/usr/local/redash.gz redash.gz
fi
'''
archiveArtifacts artifacts: 'redash.gz', onlyIfSuccessful: true
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment