20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
format=date;
esac
done
#Name of archive
if [ -z "$1" ]; then
mtt="mtt"
else
mtt="mtt-$1"
fi
## Create appropriate filename
case $format in
date)
filename=`date | awk '{printf("%s_%s%s_%s.tgz\n", mtt, $2,$3,$6)}' mtt=$mtt`;
shift
|
>
>
|
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
format=date;
esac
done
#Name of archive
if [ -z "$1" ]; then
mtt="mtt"
dirs='mtt mtt-lib mtt-cc mtt-doc'
else
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`;
shift
|
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
esac
echo Backup file $filename
#Files to backup
dir=$mtt
#Check whether archive exists here
if [ -f "$filename" ]; then
echo File $filename already exists - exiting
exit
fi
# Listing files to ignore
echo Finding irrelevant files
find $dir -name '*.*' -print |\
grep 'dvi$\|ps$\|pdf$\|html$\|info$\|gif$\|log$\|dat$\|MTT_work\|core\|~$' >IGNORE
wc IGNORE | awk '{print "Ignoring", $1, "files"}'
#echo examples >> IGNORE
#Inform user
echo Backing up $dir to $filename
#Tar the files
tar --exclude-from IGNORE --create --gzip --file $filename $dir
#Size info
ls -l $filename
#
|
<
<
<
|
|
|
|
|
|
|
|
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
|
esac
echo Backup file $filename
#Check whether archive exists here
if [ -f "$filename" ]; then
echo File $filename already exists - exiting
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"}'
#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
#
|