view storeProgram.php @ 164:254d8a21bf36

fix: 予約済みの未実行録画にrecomplete.phpが必要なので戻した
author Sushi-k <epgrec@park.mda.or.jp>
date Tue, 06 Apr 2010 11:03:45 +0900
parents 3bed74eca373
children b3ba2658a228
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();
  // ゃd
  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();	// 若若篋膣
?>