29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
-
+
-
+
|
mtt="mtt-$1"
dirs=$mtt
fi
## Create appropriate filename
case $format in
date)
filename=`date | awk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`;
filename=`date | gawk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`;
shift
;;
version)
filename=`mtt --version | awk '{printf("%s-%s.tar.gz\n", mtt, $NF)}' mtt=$mtt`;
filename=`mtt --version | gawk '{printf("%s-%s.tar.gz\n", mtt, $NF)}' mtt=$mtt`;
shift
;;
*)
esac
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
-
+
|
exit
fi
# Listing files to ignore
#echo Finding irrelevant files
#find $dirs -name '*.*' -print |\
# grep 'dvi$\|ps$\|gif$\|log$\|dat$\|MTT_work\|core\|~$' >IGNORE
#wc IGNORE | awk '{print "Ignoring", $1, "files"}'
#wc IGNORE | gawk '{print "Ignoring", $1, "files"}'
#echo examples >> IGNORE
#Inform user
echo Backing up $dirs to $filename
#Tar the files
#tar --exclude-from IGNORE --create --gzip --file $filename $dir
tar --create --gzip --file $filename $dirs
#Size info
ls -l $filename
#
|