-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathfreki.s3.sh
38 lines (32 loc) · 1.19 KB
/
freki.s3.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
!/bin/bash
# Freki S3 Backup Script
# Purpose = Backup of Important Data to Amazon S3/Glacier
# Rewrite by nwgat.ninja, orginal by Hafiz Haider
# Required packages
# curl (pushover) https://curl.haxx.se/
# s3put (s3/gcs) https://github.com/surma/s3put/releases
# Pushover Settings
pusht=0000 # token
pushu=0000 # user
# Source and Dest
SRCDIR=/home/user/importantstuff # Location of Important Data Directory (Source of backup).
DESDIR=/home/user/backup/folder # Destination of backup file.
# S3/GCS Setttings
BUCKET=backups.domain.ninja # s3 bucket name
AWSK=0000 # AWS/GCS Access Key
AWSS=0000 # AWS/GCS Secret Key
SERV=s3 # S3 or GCS
REG=https://s3.amazonaws.com # region
# other stuff
TIME=`date +%d-%m-%Y_%H-%M-%S` # This Command will add date in Backup File Name.
FILENAME=Backup-$TIME.tar.gz # Here i define Backup file name format.
# magic
echo "Compressing files.."
tar -cpzf $DESDIR/$FILENAME $SRCDIR
echo "Backing up to S3/GCS"
./s3put -c 5 $SERV -k $AWSK -s $AWSS -b https://s3.amazonaws.com/$BUCKET put $DESDIR/$FILENAME
curl -s -F "token=$pusht" -F "user=$pushu" -F "message=$FILENAME uploaded" https://api.pushover.net/1/messages
echo ""
echo "done"
echo ""
#END