-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbackup_regularly.sh
More file actions
27 lines (24 loc) · 887 Bytes
/
backup_regularly.sh
File metadata and controls
27 lines (24 loc) · 887 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
#!/bin/sh
#backup source file automatically with crontab when files size be changed.
#=========================================================================
#TODO:
# - compare the zip file size not precise, better to get the REAL changed
# info.
# - backup the file with crontab is waste time if no change happened for
# years... is it possible to do the action more graceful?
#=========================================================================
#update log:
#2013.08.23 - copy
#=========================================================================
cd ~/source
rm -rf *_backup.zip
zip -r `date +%Y%m%d%H%M%S`_backup.zip code/
current_size=`ls -l *_backup.zip | awk '{print $5}'`
last_size=`cat ~/last_size`
#echo "current $current_size"
#echo "last $last_size"
if [ $current_size -ne $last_size ]
then
cp *_backup.zip ~/
fi
echo $current_size > ~/last_size