Mercurial > epgrec.yaz
view storeProgram.php @ 165:3d4df1fe4166
merged with upstream
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Thu, 08 Apr 2010 04:22:20 +0900 |
parents | 66eabfc1b118 |
children |
line wrap: on
line source
#!/usr/bin/php <?php $script_path = dirname( __FILE__ ); chdir( $script_path ); include_once( $script_path . '/config.php'); $type = $argv[1]; // BS CS GR $file = $argv[2]; // XMLファイル // SIGTERMシグナル function handler( $signo = 0 ) { global $file; if( file_exists( $file ) ) { @unlink( $file ); } exit(); } // デーモン化 function daemon() { if( pcntl_fork() != 0 ) exit(); posix_setsid(); if( pcntl_fork() != 0 ) exit; pcntl_signal(SIGTERM, "handler"); } // デーモン化 daemon(); // プライオリティ低に pcntl_setpriority(20); include_once( INSTALL_PATH . '/DBRecord.class.php' ); include_once( INSTALL_PATH . '/Reservation.class.php' ); include_once( INSTALL_PATH . '/Keyword.class.php' ); include_once( INSTALL_PATH . '/Settings.class.php' ); include_once( INSTALL_PATH . '/storeProgram.inc.php' ); $settings = Settings::factory(); if( file_exists( $file ) ) { storeProgram( $type, $file ); @unlink( $file ); } garbageClean(); // 不要プログラム削除 doKeywordReservation(); // キーワード予約 ?>