82 lines
2.0 KiB
C++
82 lines
2.0 KiB
C++
#include "DeleteOldDataEngine.h"
|
|
|
|
|
|
using namespace ai_matrix;
|
|
|
|
DeleteOldDataEngine::DeleteOldDataEngine() {}
|
|
|
|
DeleteOldDataEngine::~DeleteOldDataEngine() {}
|
|
|
|
APP_ERROR DeleteOldDataEngine::Init()
|
|
{
|
|
bUseEngine_ = true;
|
|
// bHwDecode_ = MyYaml::GetIns()->GetBoolValue("gc_hardware_decode");//硬解码
|
|
this->outTimeDay_ = 10;
|
|
|
|
LogInfo << "DeleteOldDataEngine Init ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
APP_ERROR DeleteOldDataEngine::DeInit()
|
|
{
|
|
if (!bUseEngine_)
|
|
{
|
|
LogWarn << "engineId_:" << engineId_ << " not use engine";
|
|
return APP_ERR_OK;
|
|
}
|
|
LogInfo << "DeleteOldDataEngine DeInit ok";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
//void rm_dir( const char *path )
|
|
//{
|
|
// DIR *dir;
|
|
// struct dirent *dirp;
|
|
// struct stat buf;
|
|
// char *p = getcwd( NULL, 0 );
|
|
// if ( (dir = opendir( path ) ) == NULL )
|
|
// error_quit( "OpenDir" );
|
|
// change_path( path );
|
|
// while ( dirp = readdir( dir ) )
|
|
// {
|
|
// if ( (strcmp( dirp->d_name, "." ) == 0) || (strcmp( dirp->d_name, ".." ) == 0) )
|
|
// continue;
|
|
// if ( stat( dirp->d_name, &buf ) == -1 )
|
|
// error_quit( "stat" );
|
|
// if ( S_ISDIR( buf.st_mode ) )
|
|
// {
|
|
// rm_dir( dirp->d_name );
|
|
// /*if(rmdir(dirp->d_name)==-1)
|
|
// * error_quit("rmdir");
|
|
// * printf("rm %s Successed . . .\n",dirp->d_name);*/
|
|
// continue;
|
|
// }
|
|
// if ( remove( dirp->d_name ) == -1 )
|
|
// error_quit( "remove" );
|
|
// printf( "rm %s Successed . . .\n", dirp->d_name );
|
|
// }
|
|
// closedir( dir );
|
|
// change_path( p );
|
|
// if ( rmdir( path ) == -1 )
|
|
// error_quit( "rmdir" );
|
|
// printf( "rm %s Successed . . .\n", path );
|
|
//}
|
|
|
|
APP_ERROR DeleteOldDataEngine::Process()
|
|
{
|
|
if (!bUseEngine_)
|
|
{
|
|
LogWarn << "engineId_:" << engineId_ << " not use engine";
|
|
return APP_ERR_OK;
|
|
}
|
|
|
|
int iRet = APP_ERR_OK;
|
|
while (!isStop_)
|
|
{
|
|
|
|
"find 目录地址 -type f -ctime +10 | xargs rm -f"
|
|
|
|
}
|
|
return APP_ERR_OK;
|
|
}
|