public function bootstrap() { //log $logfile = SIM_ROOT . '/var/log/' . $this->app . '_' . $this->mypid . '.log'; Log::logfile($logfile); Log::level(Log::INFO); //process exists $pid_files = glob(SIM_ROOT . '/var/pid/' . $this->app . "*.pid"); if (is_array($pid_files) && count($pid_files) >= $this->max) { $text = "pid file(" . $pid_files[0] . ") existed."; Log::fatal($text); exit; } //pid $pid_file = SIM_ROOT . '/var/pid/' . $this->app . '_' . $this->mypid . '.pid'; if (file_put_contents($pid_file, $this->mypid)) { $this->pid_file = $pid_file; } else { Log::fatal("Unable to write pid to " . $pid_file); exit; } }