agentService = new AgentService(); } public function handle($text = null) { $this->initParams(); $this->initServices(); $this->setHostingId($this->getWhmcsParamByKey("serviceid")); $this->initVm(); $this->api(); try{ if(!sl('Vm')->getVm()->isRunning()){ $this->log->info(sprintf("VM %s - Start", sl('Vm')->getVm()->getVmid())); sl('Vm')->getVm()->start(); $this->sleep(40); return false; } sl('Vm')->getVm()->agent()->ping(); $this->agentService->configureNetwork(); }catch (ProxmoxApiException $ex){ if(preg_match("/not running/", $ex->getMessage())){ $this->log->info($ex->getMessage()); }else{ $this->log->error($ex->getMessage()); } //sleep $this->sleep(30); return false; } } }