Rev 13455 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
11086 | bpr | 1 | limit_class=300 |
8961 | bpr | 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 |
||
11086 | bpr | 12 | cnt_=!sh cd $wims_home/backup/oldclasses/$j; find . -maxdepth 1 -type f | wc -l | awk '{print $1}' |
13 | !if $cnt_ < $limit_class |
||
14277 | obado | 14 | listclass$j=!listfile -t $wims_home/backup/oldclasses/$j/*.tgz |
15 | listclass$j=!replace internal .tgz by in $(listclass$j) |
||
16 | listclass$j=!replace internal $wims_home/backup/oldclasses/$j/ by in $(listclass$j) |
||
17 | listclass$j=!words2items $(listclass$j) |
||
18 | listclass$j=!sort numeric items $(listclass$j) |
||
19 | cnt_=!itemcnt $(listclass$j) |
||
11086 | bpr | 20 | !else |
21 | listclass$j=toomuch |
||
22 | !endif |
||
14277 | obado | 23 | cnt=$[$cnt_+$cnt] |
8961 | bpr | 24 | !next |
25 | !else |
||
26 | !if $clrestore=$empty |
||
27 | error=noclass |
||
28 | !reset stepcl test |
||
29 | !exit |
||
30 | !endif |
||
31 | !if $stepcl=1 |
||
32 | date=!char 1 to 8 of $wims_now |
||
33 | month=!char 5 to 6 of $date |
||
34 | !if $month=12 |
||
35 | date=$[$date+10000 - 1100] |
||
36 | !else |
||
37 | date=$[$date+100] |
||
38 | !endif |
||
39 | class=!replace internal _ by , in $clrestore |
||
40 | !distribute item $class into year,class |
||
41 | class=!nospace $class |
||
11086 | bpr | 42 | !if $class=$empty |
43 | !if $clrestore1=$empty |
||
44 | error=noclass |
||
45 | !exit |
||
46 | !else |
||
47 | class=$clrestore1 |
||
48 | class=!text select 1234567890 in $class |
||
49 | !if $class=$empty |
||
50 | error=noclass |
||
51 | !exit |
||
52 | !endif |
||
53 | !endif |
||
54 | !endif |
||
55 | test=!sh cd $wims_home/backup/oldclasses/$year; ls $class.tgz |
||
56 | !if $test!=$class.tgz |
||
57 | error=classnotexists |
||
58 | !exit |
||
59 | !endif |
||
8961 | bpr | 60 | test=!sh cd $wims_home\ |
61 | cp backup/oldclasses/$year/$class.tgz log/classes/\ |
||
62 | cd $wims_home/log/classes/\ |
||
63 | if [ ! `ls -d $class | wc -c` -eq 0 ] ; then echo "class already existing; nothing is done" ; exit ; fi ;\ |
||
64 | tar xzf $class.tgz\ |
||
65 | perl -np -i -e "s:class_expiration=.*:class_expiration=$date:g" $class/.def\ |
||
66 | rm $class.tgz\ |
||
13455 | bpr | 67 | cd $wims_home; mkdir -p backuprestore; mv backup/oldclasses/$year/$class.tgz backuprestore |
8961 | bpr | 68 | !if $test!=$empty |
69 | error=$test |
||
70 | !reset test stepcl |
||
71 | !sh cd $wims_home/log/classes/ ; rm -f $class.tgz |
||
72 | !exit |
||
73 | !else |
||
74 | !increase stepcl |
||
75 | !endif |
||
76 | !endif |
||
77 | !endif |