Subversion Repositories wimsdev

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
16591 obado 1
 
2
!read jobs/listclassbackups.proc
3
 
4
!if $qclass = *
5
  error=You must specify one class ID to restore.
6
  !exit
7
!endif
8
 
9
!! backup_year is mandatory
10
!if $backup_year = $empty
11
  error=wrong or empty backup year in data1 ($backup_year)
12
  !exit
13
!endif
14
 
15
!if $cnt <= 0
16
  error=No backup available for class $qclass on year $backup_year.
17
  !exit
18
!endif
19
 
20
date=!char 1 to 8 of $wims_now
21
month=!char 5 to 6 of $date
22
!if $month=12
23
  date=$[$date+10000 - 1100]
24
!else
25
  date=$[$date+100]
26
!endif
27
 
28
test=!sh cd $wims_home\
29
cp backup/oldclasses/$backup_year/$qclass.tgz log/classes/\
30
cd $wims_home/log/classes/\
31
if [ ! `ls -d $qclass | wc -c` -eq 0 ] ; then echo "already existing class id $qclass; nothing was done." ; exit ; fi ;\
32
tar xzf $qclass.tgz\
33
perl -np -i -e "s:class_expiration=.*:class_expiration=$date:g" $qclass/.def\
34
rm $qclass.tgz\
35
cd $wims_home; mkdir -p backuprestore/$backup_year; mv backup/oldclasses/$backup_year/$qclass.tgz backuprestore/$backup_year
36
 
37
!if $test!=$empty
38
  error=$test
39
  !reset test
40
  !sh cd $wims_home/log/classes/ ; rm -f $qclass.tgz
41
!endif