Subversion Repositories wimsdev

Rev

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

  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.  
  18.         /* Daily housekeeping jobs. */
  19. void housekeep(void)
  20. {
  21.     char fname[1024];
  22.     FILE *keeplog;
  23.    
  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;
  28.     fread(keepdate,8,1,keeplog); keepdate[8]=0; fclose(keeplog);
  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.  
  38.         /* module update */
  39. void modupdate(void)
  40. {
  41.     char fname[1024];
  42.     FILE *muplog;
  43.    
  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;
  48.     fread(mupdate,8,1,muplog); mupdate[8]=0; fclose(muplog);
  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.  
  58.         /* Daily backup. */
  59. void backup(void)
  60. {
  61.     FILE *backlog;
  62.    
  63.     if(strncmp(backdate,nowstr,8)==0) return;
  64.     backlog=fopen("backup/backdate","r");
  65.     if(backlog==NULL) goto dobackup;
  66.     fread(backdate,8,1,backlog); backdate[8]=0; fclose(backlog);
  67.     if(strncmp(backdate,nowstr,8)==0) return;
  68.     dobackup:
  69.     call_ssh(0,"bin/backup &>%s/backup.log",tmpd);
  70. }
  71.  
  72.