-
Notifications
You must be signed in to change notification settings - Fork 0
/
backup2.sh
39 lines (25 loc) · 914 Bytes
/
backup2.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
39
#!/bin/bash
BAKUPFILE=scripts_bakup.tar.gz
echo "Welcome USER $USER."
echo "We are running script on $HOSTNAME"
echo "####################################################"
echo "You have passed $# arguments"
echo "####################################################"
echo "Below mentioned the arguments that you passed:"
echo $@
echo "####################################################"
echo "Taking backup of $1"
echo "Archiving $1"
tar -czvf $BAKUPFILE $1
echo "Exit Code of arhiving is $?"
echo "####################################################"
mv $BAKUPFILE $2
echo "Exit Code of moving backup is $?"
echo "####################################################"
echo "Archive moved to $2"
echo "Process ID of the current script is $$."
#sleep 5
echo "####################################################"
echo "Backup Completed Successfully."
sleep 5
echo "It took $SECONDS seconds time."