Subversion Repositories wimsdev

Rev

Rev 8185 | Rev 12474 | 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. */
8185 bpr 19
 
20
#include "wimslogd.h"
21
 
10 reyssat 22
void housekeep(void)
23
{
24
    char fname[1024];
25
    FILE *keeplog;
8155 bpr 26
 
10 reyssat 27
    if(strncmp(keepdate,nowstr,8)==0) return;
28
    snprintf(fname,sizeof(fname),"%s/keepdate",tmpd);
29
    keeplog=fopen(fname,"r");
30
    if(keeplog==NULL) goto dokeep;
3836 kbelabas 31
    (void)fread(keepdate,8,1,keeplog); keepdate[8]=0; fclose(keeplog);
10 reyssat 32
    if(strncmp(keepdate,nowstr,8)==0) return;
33
    dokeep:
34
    keeplog=fopen(fname,"w");
35
    if(keeplog!=NULL) {
8849 bpr 36
      fwrite(nowstr,8,1,keeplog);fclose(keeplog);
10 reyssat 37
    }
38
    call_ssh(0,"bin/housekeep.daily &>%s/housekeep.log",tmpd);
39
}
40
 
8155 bpr 41
/* module update */
10 reyssat 42
void modupdate(void)
43
{
44
    char fname[1024];
45
    FILE *muplog;
8155 bpr 46
 
10 reyssat 47
    if(strncmp(mupdate,nowstr,8)==0) return;
48
    snprintf(fname,sizeof(fname),"%s/mupdate",tmpd);
49
    muplog=fopen(fname,"r");
50
    if(muplog==NULL) goto domup;
3836 kbelabas 51
    (void)fread(mupdate,8,1,muplog); mupdate[8]=0; fclose(muplog);
10 reyssat 52
    if(strncmp(mupdate,nowstr,8)==0) return;
53
    domup:
54
    muplog=fopen(fname,"w");
55
    if(muplog!=NULL) {
8849 bpr 56
      fwrite(nowstr,8,1,muplog);fclose(muplog);
10 reyssat 57
    }
58
    call_ssh(0,"bin/modupdate.auto &>%s/modupdate.log",tmpd);
59
}
60
 
8155 bpr 61
/* Daily backup. */
10 reyssat 62
void backup(void)
63
{
64
    FILE *backlog;
8155 bpr 65
 
10 reyssat 66
    if(strncmp(backdate,nowstr,8)==0) return;
67
    backlog=fopen("backup/backdate","r");
68
    if(backlog==NULL) goto dobackup;
3836 kbelabas 69
    (void)fread(backdate,8,1,backlog); backdate[8]=0; fclose(backlog);
10 reyssat 70
    if(strncmp(backdate,nowstr,8)==0) return;
71
    dobackup:
72
    call_ssh(0,"bin/backup &>%s/backup.log",tmpd);
73
}
74