Subversion Repositories wimsdev

Rev

Rev 2497 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2497 Rev 15421
Line 3... Line 3...
3
server_base=!replace internal /public_html*** by $ in $httpd_PWD***
3
server_base=!replace internal /public_html*** by $ in $httpd_PWD***
4
backuper=$server_base/bin/backup
4
backuper=$server_base/bin/backup
5
accounter=$server_base/log/account.sh
5
accounter=$server_base/log/account.sh
6
 
6
 
7
!if $oldcrontab!=$empty and $checkline notin $oldcrontab
7
!if $oldcrontab!=$empty and $checkline notin $oldcrontab
8
 error=manual
8
  error=manual
9
 !exit
9
  !exit
10
!endif
10
!endif
11
 
11
 
12
tt=!char 1 of $server_base
12
tt=!char 1 of $server_base
13
!if $tt!=/
13
!if $tt!=/
14
 error=bad_base
14
 error=bad_base
Line 21... Line 21...
21
oldsave=
21
oldsave=
22
oldaccount=no
22
oldaccount=no
23
oldbackup_h=-1
23
oldbackup_h=-1
24
oldbackup_m=
24
oldbackup_m=
25
!for i=1 to $n
25
!for i=1 to $n
26
 l=!line $i of $oldcrontab
26
  l=!line $i of $oldcrontab
27
 l=!trim $l
27
  l=!trim $l
28
 c=!char 1 of $l
28
  c=!char 1 of $l
29
 !if $c!=#
29
  !if $c!=#
30
  !distribute words $l into w1,w2,w3,w4,w5,w6,w7
30
    !distribute words $l into w1,w2,w3,w4,w5,w6,w7
31
  !if $w3=* and $w4=* and $w5=* and $w6 iswordof \
31
    !if $w3=* and $w4=* and $w5=* and $w6 iswordof \
32
	$backuper $accounter
32
       $backuper $accounter
33
   !if $w6=$backuper
33
      !if $w6=$backuper
34
    oldbackup_h=$[$w2]
34
        oldbackup_h=$[$w2]
35
    oldbackup_m=$[$w1]
35
        oldbackup_m=$[$w1]
36
   !endif
36
      !endif
37
   !if $w6=$accounter
37
      !if $w6=$accounter
38
    oldaccount=yes
38
        oldaccount=yes
39
   !endif
39
      !endif
40
  !else
40
    !else
41
   !if bin/backup notin $l and log/account.sh notin $l
41
      !if bin/backup notin $l and log/account.sh notin $l
42
    oldsave=!append line $l to $oldsave
42
        oldsave=!append line $l to $oldsave
-
 
43
      !endif
43
   !endif
44
    !endif
44
  !endif
45
  !endif
45
 !endif
-
 
46
!next i
46
!next i
47
 
47
 
48
 
48
 
49
!if $job2=second and $abandon=$empty
49
!if $job2=second and $abandon=$empty
50
 !bound crontab_backup_h between integer -1 and 23 default -1
50
  !bound crontab_backup_h between integer -1 and 23 default -1
51
 !bound crontab_backup_m between integer 0 and 59 default $[randint(59)]
51
  !bound crontab_backup_m between integer 0 and 59 default $[randint(59)]
52
 !bound crontab_account among yes,no default no
52
  !bound crontab_account among yes,no default no
53
 newcron=$checkline
53
  newcron=$checkline
54
 !if $crontab_backup_h>=0
54
  !if $crontab_backup_h>=0
55
  newcron=$newcron\
55
    newcron=$newcron\
56
\
56
\
57
# Daily backup\
57
# Daily backup\
58
$crontab_backup_m $crontab_backup_h * * * $backuper >/dev/null
58
$crontab_backup_m $crontab_backup_h * * * $backuper >/dev/null
59
 !endif
59
  !endif
60
 !if $crontab_account=yes
60
  !if $crontab_account=yes
61
  newcron=$newcron\
61
    newcron=$newcron\
62
\
62
\
63
# Activity accounting\
63
# Activity accounting\
64
16 0 * * * $accounter >/dev/null
64
16 0 * * * $accounter >/dev/null
65
 !endif
65
  !endif
66
 newcron=$newcron\
66
  newcron=$newcron\
67
\
67
\
68
# Saved from old (manual?) crontab\
68
# Saved from old (manual?) crontab\
69
$oldsave
69
$oldsave
70
 !sh cat >../tmp/crontab <<@\
70
 !sh cat >../tmp/crontab <<@\
71
$newcron\
71
$newcron\
72
@\
72
@\
73
crontab ../tmp/crontab
73
crontab ../tmp/crontab
74
 job2=
74
  job2=
75
 oldcrontab=!sh crontab -l 2>/dev/null
75
  oldcrontab=!sh crontab -l 2>/dev/null
76
 !goto readcron
76
  !goto readcron
77
!endif
77
!endif
78
 
-
 
79
 
-