Junyoung Jung

Update backup.sh

Showing 1 changed file with 21 additions and 7 deletions
1 #!/bin/bash 1 #!/bin/bash
2 2
3 -NAME=$(date +%m%d%H%M) 3 +NAME=$(date +%y%m%d)
4 4
5 -HOST='User remote server ip' 5 +HOST='celinux2.khu.ac.kr'
6 -USER='User id' 6 +USER='usp33'
7 FILE=$NAME'.tar' 7 FILE=$NAME'.tar'
8 8
9 -tar -cvzf $NAME.tar * 9 +MakeTarFile() {
10 + tar -cvzf $NAME.tar *
11 +}
10 12
11 -sftp $USER@$HOST << END_SCRIPT 13 +ConnectSFTP() {
12 -put $FILE 14 + sftp $USER@$HOST << END_SCRIPT
13 -quit 15 + put $FILE
16 + quit
14 END_SCRIPT 17 END_SCRIPT
18 +}
19 +
20 +for i in {0..75..3}
21 + do
22 + MakeTarFile
23 + ConnectSFTP
24 + rm $FILE
25 +
26 + sleep 3m
27 + done
28 +
15 exit 0 29 exit 0
...\ No newline at end of file ...\ No newline at end of file
......