/** * @file Upload.php * @author niuyunkun(niuyunkun@baidu.com) * @date 2013/08/30 14:09:43 * @version $Revision$ * @brief * **/ #require_once( "./Base.php") ; require_once "./Init.php"; //初始化 $strApp = $argv[1]; $strPipelet = $argv[2]; list($tmp, $app) = explode("=", $strApp); list($tmp, $pipelet) = explode("=", $strPipelet); $init = new ETL_Init(); $init->init($argc, $argv); $arrAppConf = $init->getAppConf(); $dataPath = ETL_DATA . $app; define('MODULE', $app); while (true) { //检查待上传文件,push到队列中 exec("cd {$dataPath} && ls {$app}_{$pipelet}_*", $dir, $ret); $arrFileToUpload = array(); foreach ($dir as $key => $file) { if (preg_match("/^({$app}_{$pipelet}_\\d{12})\$/", $file, $arrMatch)) { $arrFileToUpload[$arrMatch[1]] = ''; } else { if (preg_match("/^({$app}_{$pipelet}_\\d{12})\\.done\$/", $file, $arrMatch)) { $arrFileToUpload[$arrMatch[1]] = "done"; }
<?php /*************************************************************************** * ETL入库程序 * Copyright (c) 2013 Baidu.com, Inc. All Rights Reserved * $Id$ * **************************************************************************/ /** * @file Main.php * @author niuyunkun(niuyunkun@baidu.com) * @date 2013/08/08 16:58:32 * @version $Revision$ * @brief * **/ require_once "./Init.php"; require_once "./Data.php"; $init = new ETL_Init(); $init->init($argc, $argv); $data = new ETL_Data(); $data->execute(); echo "\n\ndone\n"; /* vim: set ts=4 sw=4 sts=4 tw=100 noet: */