|
@@ -226,17 +226,23 @@ int main(int argc, char *argv[]) {
|
|
|
return 0;
|
|
|
}
|
|
|
if(strcmp(argv[1], "log") == 0){
|
|
|
+ unsigned char ModelName[64];;
|
|
|
unsigned char SerialNo[64];;
|
|
|
+ memcpy(ModelName,ShmSysConfigAndInfo->SysConfig.ModelName,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.ModelName));
|
|
|
+ printf("%s", ModelName);
|
|
|
memcpy(SerialNo,ShmSysConfigAndInfo->SysConfig.SerialNumber,ARRAY_SIZE(ShmSysConfigAndInfo->SysConfig.SerialNumber));
|
|
|
printf("%s", SerialNo);
|
|
|
- int year,month,i,ty,tm,cnt;
|
|
|
- char ym[7] ;
|
|
|
+ int year,month,day,hour,min,sec,i,ty,tm,cnt;
|
|
|
char pwd[70];
|
|
|
char cmd[100];
|
|
|
time_t tt = time(0); //獲取當前時間
|
|
|
struct tm *pst = localtime(&tt); //把time_t類型轉換為struct tm類型
|
|
|
year = pst->tm_year + 1900;
|
|
|
month = pst->tm_mon + 1;
|
|
|
+ day = pst->tm_mday;
|
|
|
+ hour = pst->tm_hour;
|
|
|
+ min = pst->tm_min;
|
|
|
+ sec = pst->tm_sec;
|
|
|
if((argc == 3) && isdigit(*argv[2])){
|
|
|
cnt=atoi(argv[2]);
|
|
|
}
|
|
@@ -252,16 +258,16 @@ int main(int argc, char *argv[]) {
|
|
|
tm=month-i;
|
|
|
ty=year;
|
|
|
}
|
|
|
- sprintf(ym,"%04d-%02d",ty,tm);
|
|
|
sprintf(pwd,"%04d%02d%s",year,month,SerialNo);
|
|
|
- sprintf(cmd,"zip --password %s \t /mnt/%04d-%02d.zip \t /Storage/ChargeLog/*%04d*%02d*\n",pwd,year,month,ty,tm);
|
|
|
+ sprintf(cmd,"zip --password %s \t /mnt/%s-%s-%04d%02d%02d%02d%02d%02d.zip \t /Storage/ChargeLog/*%04d*%02d*\n",pwd,ModelName,SerialNo,year,month,day,hour,min,sec,ty,tm);
|
|
|
system(cmd);
|
|
|
- sprintf(cmd,"zip --password %s \t /mnt/%04d-%02d.zip \t /Storage/EventLog/*%04d*%02d*\n",pwd,year,month,ty,tm);
|
|
|
+ sprintf(cmd,"zip --password %s \t /mnt/%s-%s-%04d%02d%02d%02d%02d%02d.zip \t /Storage/EventLog/*%04d*%02d*\n",pwd,ModelName,SerialNo,year,month,day,hour,min,sec,ty,tm);
|
|
|
system(cmd);
|
|
|
- sprintf(cmd,"zip --password %s \t /mnt/%04d-%02d.zip \t /Storage/SystemLog/*%04d*%02d*\n",pwd,year,month,ty,tm);
|
|
|
+ sprintf(cmd,"zip --password %s \t /mnt/%s-%s-%04d%02d%02d%02d%02d%02d.zip \t /Storage/SystemLog/*%04d*%02d*\n",pwd,ModelName,SerialNo,year,month,day,hour,min,sec,ty,tm);
|
|
|
+ system(cmd);
|
|
|
+ sprintf(cmd,"zip --password %s \t /mnt/%s-%s-%04d%02d%02d%02d%02d%02d.zip \t /Storage/OCPP/*%04d*%02d*\n",pwd,ModelName,SerialNo,year,month,day,hour,min,sec,ty,tm);
|
|
|
system(cmd);
|
|
|
printf("Log packing is done!\n");
|
|
|
- // zip --password "'.date('Ym').$SerialNumber.'" -r /var/www/log.zip /Storage/
|
|
|
}
|
|
|
}
|
|
|
}
|