Skip to content

Commit 4a216c9

Browse files
committed
create a backup
1 parent 4a778f2 commit 4a216c9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

Bash_basics/create_backup.sh

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#!/bin/bash
2+
3+
#Description:
4+
#Script automate the backup, tramsfer, and removal of a local backup file.
5+
6+
#Author: Abraham
7+
#=========================================================================
8+
9+
#Current day
10+
DAY="$(date+%Y%m%d)"
11+
12+
#Input to the scp command
13+
SAVE="[email protected]:/tmp"
14+
15+
#Back up file
16+
BACKUP="/home/labsuser/$DAY-backup-companyA.tar.gz"
17+
18+
#Creates tarbal
19+
sudo tar -csvpzf $BACKUP /home/labsuser/companyA
20+
21+
# Sends backup file to tmp directory
22+
scp $BACKUP $SAVE
23+
24+
#Removes backup from original location
25+
rm $BACKUP

0 commit comments

Comments
 (0)