-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbashBackup.sh
More file actions
54 lines (34 loc) · 894 Bytes
/
Copy pathbashBackup.sh
File metadata and controls
54 lines (34 loc) · 894 Bytes
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
#script that compresses a folder into a tar.gz and moves it to a remote server
#keeps 7 daily backups at a time
#dependencies
#rsync
#tar
#config variables
remote_server=''
remote_dir='/mnt/drive'
remote_port='22'
remote_user=''
local_directory='/mnt/FTP_drive'
tmp_directory='/mnt/FTP_drive/tmp/'
#program variables
day=$(date +%F)
#start program
cd $tmp_directory
rm *.tar # clear tmp folder
echo 'Packing file'
tar -vcf $day.tar $local_directory
echo 'Changing Permissions'
chmod 750 $day.tar
echo 'Starting server transfer'
rsync -zav $day.tar $remote_user@$remote_server:$remote_dir
#lftp -p $remote_port -u $remote_user $remote_server << --EOF--
# cd $remote_dir
# rm $day.tar.gz
# put $day.tar.gz
# quit
#--EOF--
ls -lh
echo 'Removing temporary file'
rm *.tar
echo 'All operations completed'