forked from AbeTavarez/Python_DevOps_Scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcreate_backup.sh
More file actions
25 lines (17 loc) Β· 3.95 KB
/
Copy pathcreate_backup.sh
File metadata and controls
25 lines (17 loc) Β· 3.95 KB
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
#!/bin/bash
#Description:
#Script automate the backup, tramsfer, and removal of a local backup file.
#Author: Abraham
#=========================================================================
#Current day
DAY="$(date+%Y%m%d)"
#Input to the scp command
SAVE="labsuser@127.0.0.1:/tmp"
#Back up file
BACKUP="/home/labsuser/$DAY-backup-companyA.tar.gz"
#Creates tarbal
sudo tar -csvpzf $BACKUP /home/labsuser/companyA
# Sends backup file to tmp directory
scp $BACKUP $SAVE
#Removes backup from original location
rm $BACKUP