Rev 8961 | Rev 11086 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
8961 | bpr | 1 | |
2 | !if $stepcl=$empty |
||
3 | listyear=!listfile -t $wims_home/backup/oldclasses |
||
9188 | bpr | 4 | listyear=!lines2items $listyear |
5 | listyear=!words2items $listyear |
||
8961 | bpr | 6 | !if $listyear=$empty |
7 | error=noyear |
||
8 | !exit |
||
9 | !endif |
||
10 | !set cnt=0 |
||
11 | !for j in $listyear |
||
12 | listclass$j=!listfile -t $wims_home/backup/oldclasses/$j/*.tgz |
||
13 | listclass$j=!replace internal .tgz by in $(listclass$j) |
||
14 | listclass$j=!replace internal $wims_home/backup/oldclasses/$j/ by in $(listclass$j) |
||
15 | listclass$j=!words2items $(listclass$j) |
||
16 | cnt_=!itemcnt $(listclass$j) |
||
17 | cnt=$[$cnt_+$cnt] |
||
18 | !next |
||
19 | !else |
||
20 | !if $clrestore=$empty |
||
21 | error=noclass |
||
22 | !reset stepcl test |
||
23 | !exit |
||
24 | !endif |
||
25 | !if $stepcl=1 |
||
26 | date=!char 1 to 8 of $wims_now |
||
27 | month=!char 5 to 6 of $date |
||
28 | !if $month=12 |
||
29 | date=$[$date+10000 - 1100] |
||
30 | !else |
||
31 | date=$[$date+100] |
||
32 | !endif |
||
33 | class=!replace internal _ by , in $clrestore |
||
34 | !distribute item $class into year,class |
||
35 | class=!nospace $class |
||
36 | test=!sh cd $wims_home\ |
||
37 | cp backup/oldclasses/$year/$class.tgz log/classes/\ |
||
38 | cd $wims_home/log/classes/\ |
||
39 | if [ ! `ls -d $class | wc -c` -eq 0 ] ; then echo "class already existing; nothing is done" ; exit ; fi ;\ |
||
40 | tar xzf $class.tgz\ |
||
41 | perl -np -i -e "s:class_expiration=.*:class_expiration=$date:g" $class/.def\ |
||
42 | rm $class.tgz\ |
||
43 | cd $wims_home; mkdir -p backup2; mv backup/oldclasses/$year/$class.tgz backup2 |
||
44 | !if $test!=$empty |
||
45 | error=$test |
||
46 | !reset test stepcl |
||
47 | !sh cd $wims_home/log/classes/ ; rm -f $class.tgz |
||
48 | !exit |
||
49 | !else |
||
50 | !increase stepcl |
||
51 | !endif |
||
52 | !endif |
||
53 | !endif |
||
54 |