Skip to content

Instantly share code, notes, and snippets.

@calvinlfer
Last active March 2, 2022 06:52
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save calvinlfer/55db013f17fb8047a753174e73cc5919 to your computer and use it in GitHub Desktop.
Save calvinlfer/55db013f17fb8047a753174e73cc5919 to your computer and use it in GitHub Desktop.
Pushing Jenkins ThinBackup backups to S3
#!/bin/bash -l
# find latest backup
thinbackup_path="$JENKINS_HOME/thinBackup"
latest_backup_folder=$(ls -t $thinbackup_path | head -n1)
full_path="$thinbackup_path/$latest_backup_folder"
echo "Latest backup is located at ${full_path}"
# pack it up
backup_name="$latest_backup_folder.tar.gz"
tar cvzf $backup_name $full_path
# push to S3
S3_BUCKET_BACKUP="yourcompany-jenkins-backup"
aws s3 cp $backup_name s3://$S3_BUCKET_BACKUP/thinBackup/
@calvinlfer
Copy link
Author

ThinBackup configuration

@calvinlfer
Copy link
Author

calvinlfer commented Apr 25, 2018

This assumes you have the aws-cli installed and your machine has the right permissions to push files to S3 (make sure to use the right bucket)

@calvinlfer
Copy link
Author

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