Subversion Repositories wimsdev

Rev

Rev 3836 | Rev 8185 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
10 reyssat 1
/*    Copyright (C) 1998-2003 XIAO, Gang of Universite de Nice - Sophia Antipolis
2
 *
3
 *  This program is free software; you can redistribute it and/or modify
4
 *  it under the terms of the GNU General Public License as published by
5
 *  the Free Software Foundation; either version 2 of the License, or
6
 *  (at your option) any later version.
7
 *
8
 *  This program is distributed in the hope that it will be useful,
9
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
10
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11
 *  GNU General Public License for more details.
12
 *
13
 *  You should have received a copy of the GNU General Public License
14
 *  along with this program; if not, write to the Free Software
15
 *  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
16
 */
17
 
8155 bpr 18
/* Daily housekeeping jobs. */
10 reyssat 19
void housekeep(void)
20
{
21
    char fname[1024];
22
    FILE *keeplog;
8155 bpr 23
 
10 reyssat 24
    if(strncmp(keepdate,nowstr,8)==0) return;
25
    snprintf(fname,sizeof(fname),"%s/keepdate",tmpd);
26
    keeplog=fopen(fname,"r");
27
    if(keeplog==NULL) goto dokeep;
3836 kbelabas 28
    (void)fread(keepdate,8,1,keeplog); keepdate[8]=0; fclose(keeplog);
10 reyssat 29
    if(strncmp(keepdate,nowstr,8)==0) return;
30
    dokeep:
31
    keeplog=fopen(fname,"w");
32
    if(keeplog!=NULL) {
33
        fwrite(nowstr,8,1,keeplog);fclose(keeplog);
34
    }
35
    call_ssh(0,"bin/housekeep.daily &>%s/housekeep.log",tmpd);
36
}
37
 
8155 bpr 38
/* module update */
10 reyssat 39
void modupdate(void)
40
{
41
    char fname[1024];
42
    FILE *muplog;
8155 bpr 43
 
10 reyssat 44
    if(strncmp(mupdate,nowstr,8)==0) return;
45
    snprintf(fname,sizeof(fname),"%s/mupdate",tmpd);
46
    muplog=fopen(fname,"r");
47
    if(muplog==NULL) goto domup;
3836 kbelabas 48
    (void)fread(mupdate,8,1,muplog); mupdate[8]=0; fclose(muplog);
10 reyssat 49
    if(strncmp(mupdate,nowstr,8)==0) return;
50
    domup:
51
    muplog=fopen(fname,"w");
52
    if(muplog!=NULL) {
53
        fwrite(nowstr,8,1,muplog);fclose(muplog);
54
    }
55
    call_ssh(0,"bin/modupdate.auto &>%s/modupdate.log",tmpd);
56
}
57
 
8155 bpr 58
/* Daily backup. */
10 reyssat 59
void backup(void)
60
{
61
    FILE *backlog;
8155 bpr 62
 
10 reyssat 63
    if(strncmp(backdate,nowstr,8)==0) return;
64
    backlog=fopen("backup/backdate","r");
65
    if(backlog==NULL) goto dobackup;
3836 kbelabas 66
    (void)fread(backdate,8,1,backlog); backdate[8]=0; fclose(backlog);
10 reyssat 67
    if(strncmp(backdate,nowstr,8)==0) return;
68
    dobackup:
69
    call_ssh(0,"bin/backup &>%s/backup.log",tmpd);
70
}
71