本文整理汇总了PHP中log::getPathToLog方法的典型用法代码示例。如果您正苦于以下问题:PHP log::getPathToLog方法的具体用法?PHP log::getPathToLog怎么用?PHP log::getPathToLog使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类log
的用法示例。
在下文中一共展示了log::getPathToLog方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: updateSonos
public static function updateSonos()
{
log::remove('sonos_update');
$cmd = 'sudo /bin/bash ' . dirname(__FILE__) . '/../../ressources/install.sh';
$cmd .= ' >> ' . log::getPathToLog('sonos_update') . ' 2>&1 &';
exec($cmd);
}
示例2: runDeamon
public static function runDeamon()
{
if (!file_exists('/opt/homebridge/config.json')) {
$response = array();
$platform = array();
$response['description'] = "Configuration Jeedom";
$platform['platform'] = "Jeedom";
$platform['name'] = "Jeedom";
$platform['jeedom_ip'] = "127.0.0.1";
$platform['jeedom_port'] = config::byKey('internalPort');
$platform['jeedom_url'] = config::byKey('internalComplement');
$platform['jeedom_api_key'] = config::byKey('api');
$response['platforms'] = array();
$response['platforms'][] = $platform;
$response['accessories'] = array();
$fp = fopen('/opt/homebridge/config.json', 'w');
fwrite($fp, json_encode($response));
fclose($fp);
}
log::add('homebridge', 'info', 'Lancement du démon homebridge');
$cmd = 'nice -n 19 /usr/bin/nodejs /opt/homebridge/app.js';
log::add('homebridge', 'info', 'Lancement démon homebridge : ' . $cmd);
$result = exec('nohup ' . $cmd . ' >> ' . log::getPathToLog('homebridge') . ' 2>&1 &');
if (!self::deamonRunning()) {
sleep(10);
if (!self::deamonRunning()) {
log::add('homebridge', 'error', 'Impossible de lancer le démon homebridge', 'unableStartDeamon');
return false;
}
}
message::removeAll('homebridge', 'unableStartDeamon');
log::add('homebridge', 'info', 'Démon homebridge lancé');
}
示例3: runDeamon
public static function runDeamon()
{
log::add('rfxcom', 'info', 'Lancement du démon RFXcom');
$port = config::byKey('port', 'rfxcom');
if (!file_exists($port)) {
config::save('port', '', 'rfxcom');
throw new Exception('Le port : ' . $port . ' n\'éxiste pas');
}
$rfxcom_path = realpath(dirname(__FILE__) . '/../../ressources/rfxcmd');
$trigger = file_get_contents($rfxcom_path . '/trigger_tmpl.xml');
$config = file_get_contents($rfxcom_path . '/config_tmpl.xml');
$pid_file = realpath(dirname(__FILE__) . '/../../../../tmp') . '/rfxcom.pid';
if (file_exists($rfxcom_path . '/trigger.xml')) {
unlink($rfxcom_path . '/trigger.xml');
}
if (file_exists($rfxcom_path . '/config.xml')) {
unlink($rfxcom_path . '/config.xml');
}
file_put_contents($rfxcom_path . '/trigger.xml', str_replace('#path#', $rfxcom_path . '/../../core/php/jeeRfxcom.php', $trigger));
$config = str_replace('#log_path#', log::getPathToLog('rfxcmd'), str_replace('#trigger_path#', $rfxcom_path . '/trigger.xml', $config));
file_put_contents($rfxcom_path . '/config.xml', $config);
chmod($rfxcom_path . '/trigger.xml', 0777);
chmod($rfxcom_path . '/config.xml', 0777);
$cmd = '/usr/bin/python ' . $rfxcom_path . '/rfxcmd.py -z -d ' . $port;
$cmd .= ' -o ' . $rfxcom_path . '/config.xml --pidfile=' . $pid_file;
log::add('rfxcmd', 'info', 'Lancement démon rfxcmd : ' . $cmd);
$result = exec('nohup ' . $cmd . ' >> ' . log::getPathToLog('rfxcmd') . ' 2>&1 &');
if (strpos(strtolower($result), 'error') !== false || strpos(strtolower($result), 'traceback') !== false) {
log::add('rfxcom', 'error', $result);
return false;
}
if (!self::deamonRunning()) {
sleep(10);
if (!self::deamonRunning()) {
log::add('rfxcom', 'info', 'Impossible de lancer le démon RFXcom');
return false;
}
}
log::add('rfxcom', 'info', 'Démon RFXcom lancé');
}
示例4: launch
public function launch($_trigger_id, $_value)
{
$cmd = 'nohup php ' . dirname(__FILE__) . '/../../core/php/jeeAlarm.php ';
$cmd .= ' eqLogic_id=' . $this->getId() . ' trigger_id=' . $_trigger_id . ' value=' . $_value;
$cmd .= ' >> ' . log::getPathToLog('alarm') . ' 2>&1 &';
shell_exec($cmd);
return true;
}
示例5: Exception
ajax::success(openzwave::listServerZwave());
}
if (init('action') == 'autoDetectModule') {
$eqLogic = openzwave::byId(init('id'));
if (!is_object($eqLogic)) {
throw new Exception(__('Zwave eqLogic non trouvé : ', __FILE__) . init('id'));
}
foreach ($eqLogic->getCmd() as $cmd) {
$cmd->remove();
}
$eqLogic->createCommand(true);
ajax::success();
}
if (init('action') == 'migrateZwave') {
$cmd = 'sudo php ' . dirname(__FILE__) . '/../../script/migrate.php';
$cmd .= ' >> ' . log::getPathToLog('openzwave_migrate') . ' 2>&1 &';
exec($cmd);
ajax::success();
}
if (init('action') == 'getAllPossibleConf') {
$eqLogic = openzwave::byId(init('id'));
if (!is_object($eqLogic)) {
ajax::success();
}
ajax::success($eqLogic->getConfFilePath(true));
}
if (init('action') == 'getConfiguration') {
if (init('translation') == 1 && config::byKey('language', 'core', 'fr_FR') != 'fr_FR') {
ajax::success();
}
$id = init('manufacturer_id') . '.' . init('product_type') . '.' . init('product_id');
示例6: launch
public function launch($_force = false, $_trigger = '', $_message = '', $_speedPriority = null)
{
if (config::byKey('enableScenario') != 1 || $this->getIsActive() != 1) {
return false;
}
if ($_speedPriority === null) {
$_speedPriority = $this->getConfiguration('speedPriority', 0);
}
if ($_speedPriority == 1) {
return $this->execute($_trigger, $_message);
} else {
$cmd = 'php ' . dirname(__FILE__) . '/../../core/php/jeeScenario.php ';
$cmd .= ' scenario_id=' . $this->getId();
$cmd .= ' force=' . $_force;
$cmd .= ' trigger=' . escapeshellarg($_trigger);
$cmd .= ' message=' . escapeshellarg($_message);
$cmd .= ' >> ' . log::getPathToLog('scenario_execution') . ' 2>&1 &';
exec($cmd);
}
return true;
}
示例7: start_openvpn
public function start_openvpn()
{
$this->stop_openvpn();
$this->writeConfig();
$log_name = 'openvpn_' . str_replace(' ', '_', $this->getName());
log::remove($log_name);
$cmd = 'sudo ' . $this->getCmdLine() . ' >> ' . log::getPathToLog($log_name) . ' 2>&1 &';
log::add($log_name, 'info', __('Lancement openvpn : ', __FILE__) . $cmd);
shell_exec($cmd);
$this->updateState();
}
示例8: updateSystem
public static function updateSystem()
{
if (config::byKey('update::autoSystem') == 1 && jeedom::isCapable('systemUpdate') && jeedom::isCapable('sudo')) {
$output = array();
$return_val = -1;
log::remove('system_update');
exec('sudo apt-get -y update >> ' . log::getPathToLog('system_update') . ' 2>&1', $output, $return_val);
if ($return_val != 0) {
log::add('update', 'error', __('Echec de la mise à jour des dépot, veuillez consulter la log system_update', __FILE__));
return;
}
exec('sudo DEBIAN_FRONTEND=noninteractive apt-get -q -y -o "Dpkg::Options::=--force-confdef" -o "Dpkg::Options::=--force-confold" dist-upgrade >> ' . log::getPathToLog('system_update') . ' 2>&1', $output, $return_val);
if ($return_val != 0) {
log::add('update', 'error', __('Echec de la mise à jour des paquets, veuillez consulter la log system_update', __FILE__));
return;
}
exec('sudo apt-get -y autoremove >> ' . log::getPathToLog('system_update') . ' 2>&1', $output, $return_val);
if ($return_val != 0) {
log::add('update', 'error', __('Echec su nettoyage des paquets, veuillez consulter la log system_update', __FILE__));
return;
}
exec('sudo service cron restart');
}
}
示例9: updateSystem
public static function updateSystem()
{
log::clear('update');
$cmd = 'sudo chown wwww-data:www-data ' . dirname(__FILE__) . '/../../install/update_system.sh;';
$cmd .= 'sudo chmod +x ' . dirname(__FILE__) . '/../../install/update_system.sh;';
$cmd .= 'sudo ' . dirname(__FILE__) . '/../../install/update_system.sh';
$cmd .= ' >> ' . log::getPathToLog('update') . ' 2>&1 &';
exec($cmd);
}
示例10: run
/**
* Launch cron (this method must be only call by jeecron master)
* @throws Exception
*/
public function run($_noErrorReport = false)
{
$cmd = '/usr/bin/php ' . dirname(__FILE__) . '/../php/jeeCron.php';
$cmd .= ' cron_id=' . $this->getId();
if (!$this->running()) {
exec($cmd . ' >> ' . log::getPathToLog('cron_execution') . ' 2>&1 &');
} else {
if (!$_noErrorReport) {
$this->halt();
if (!$this->running()) {
exec($cmd . ' >> /dev/null 2>&1 &');
} else {
throw new Exception(__('Impossible d\'exécuter la tâche car elle est déjà en cours d\'exécution (', __FILE__) . ' : ' . $cmd);
}
}
}
}
示例11: deamon_start
public static function deamon_start($_debug = false)
{
self::deamon_stop();
$deamon_info = self::deamon_info();
if ($deamon_info['launchable'] != 'ok') {
throw new Exception(__('Veuillez vérifier la configuration', __FILE__));
}
log::remove('openzwavecmd');
$port = config::byKey('port', 'openzwave');
if ($port != 'auto') {
$port = jeedom::getUsbMapping($port);
}
if (config::byKey('jeeNetwork::mode') == 'slave') {
$serverId = config::byKey('jeeNetwork::slave::id');
$callback = config::byKey('jeeNetwork::master::ip') . '/plugins/openzwave/core/php/jeeZwave.php';
$apikey = config::byKey('jeeNetwork::master::apikey');
} else {
$serverId = 0;
$callback = network::getNetworkAccess('internal', 'proto:127.0.0.1:port:comp') . '/plugins/openzwave/core/php/jeeZwave.php';
$apikey = config::byKey('api');
}
$port_server = config::byKey('port_server', 'openzwave', 8083);
$openzwave_path = dirname(__FILE__) . '/../../ressources/zwaveserver';
$config_path = dirname(__FILE__) . '/../../ressources/openzwave/config';
$data_path = dirname(__FILE__) . '/../../data';
if (!file_exists($data_path)) {
exec('mkdir ' . $data_path . ' && chmod 775 -R ' . $data_path . ' && chown -R www-data:www-data ' . $data_path);
}
$log = $_debug ? 'Debug' : 'Error';
$cmd = '/usr/bin/python ' . $openzwave_path . '/openZWave.py ';
$cmd .= ' --pidfile=/tmp/openzwave.pid';
$cmd .= ' --device=' . $port;
$cmd .= ' --log=' . $log;
$cmd .= ' --port=' . $port_server;
$cmd .= ' --config_folder=' . $config_path;
$cmd .= ' --data_folder=' . $data_path;
$cmd .= ' --callback=' . $callback;
$cmd .= ' --apikey=' . $apikey;
$cmd .= ' --serverId=' . $serverId;
log::add('openzwavecmd', 'info', 'Lancement démon openzwave : ' . $cmd);
$result = exec($cmd . ' >> ' . log::getPathToLog('openzwavecmd') . ' 2>&1 &');
if (strpos(strtolower($result), 'error') !== false || strpos(strtolower($result), 'traceback') !== false) {
log::add('openzwavecmd', 'error', $result);
return false;
}
$i = 0;
while ($i < 30) {
$deamon_info = self::deamon_info();
if ($deamon_info['state'] == 'ok') {
break;
}
sleep(1);
$i++;
}
if ($i >= 30) {
log::add('openzwavecmd', 'error', 'Impossible de lancer le démon openzwave, relancer le démon en debug et vérifiez la log', 'unableStartDeamon');
return false;
}
message::removeAll('openzwave', 'unableStartDeamon');
log::add('openzwavecmd', 'info', 'Démon openzwave lancé');
}
示例12: runDeamon
public static function runDeamon()
{
log::add('mySensors', 'info', 'Lancement du démon mySensors');
$modem_serie_addr = config::byKey('usbGateway', 'mySensors');
if ($modem_serie_addr == "serie") {
$usbGateway = config::byKey('modem_serie_addr', 'mySensors');
} else {
$usbGateway = jeedom::getUsbMapping(config::byKey('usbGateway', 'mySensors'));
}
if ($modem_serie_addr == "network") {
$gateMode = "Network";
$netAd = explode(":", config::byKey('gateway_addr', 'mySensors'));
$usbGateway = $netAd[0];
$gatePort = $netAd[1];
} else {
$gateMode = "Serial";
$gatePort = "";
}
if ($usbGateway == '') {
throw new Exception(__('Le port : ', __FILE__) . $port . __(' n\'éxiste pas', __FILE__));
}
if (config::byKey('jeeNetwork::mode') == 'slave') {
//Je suis l'esclave
$url = 'http://' . config::byKey('jeeNetwork::master::ip') . '/core/api/jeeApi.php?api=' . config::byKey('jeeNetwork::master::apikey');
} else {
if (stripos(config::byKey('internalAddr'), 'jeedom') !== FALSE) {
//on est pas sur une Mini
$jeeurl = "http://127.0.0.1/jeedom";
} else {
$jeeurl = "http://127.0.0.1";
}
$url = $jeeurl . '/core/api/jeeApi.php?api=' . config::byKey('api');
}
$sensor_path = realpath(dirname(__FILE__) . '/../../node');
$cmd = 'nice -n 19 node ' . $sensor_path . '/mysensors.js ' . $url . ' ' . $usbGateway . ' ' . $gateMode . ' ' . $gatePort;
log::add('mySensors', 'info', 'Lancement démon mySensors : ' . $cmd);
$result = exec('nohup ' . $cmd . ' >> ' . log::getPathToLog('mySensors') . ' 2>&1 &');
if (strpos(strtolower($result), 'error') !== false || strpos(strtolower($result), 'traceback') !== false) {
log::add('mySensors', 'error', $result);
return false;
}
sleep(2);
if (!self::deamonRunning()) {
sleep(10);
if (!self::deamonRunning()) {
log::add('mySensors', 'error', 'Impossible de lancer le démon mySensors, vérifiez le port', 'unableStartDeamon');
return false;
}
}
message::removeAll('mySensors', 'unableStartDeamon');
log::add('mySensors', 'info', 'Démon mySensors lancé');
}
示例13: dns_start
public static function dns_start()
{
log::add('dns_jeedom', 'debug', 'Redemarrage du service DNS');
self::dns_stop();
$cmd = '/usr/bin/nodejs ' . dirname(__FILE__) . '/../../script/localtunnel/bin/client';
$cmd .= ' --host http://dns.jeedom.fr --port 80 --authentification ' . config::byKey('ngrok::token') . ' --subdomain ' . config::byKey('ngrok::addr');
exec($cmd . ' >> ' . log::getPathToLog('dns_jeedom') . ' 2>&1 &');
return true;
}
示例14: updateZwayServer
public static function updateZwayServer($_version = '')
{
log::remove('zway_update');
if ($_version != '') {
$cmd = 'sudo /bin/bash ' . dirname(__FILE__) . '/../../resources/zway_update.sh ' . $_version;
} else {
$cmd = 'sudo /bin/bash ' . dirname(__FILE__) . '/../../resources/zway_update.sh';
}
$cmd .= ' >> ' . log::getPathToLog('zway_update') . ' 2>&1 &';
exec($cmd);
}
示例15: dns_start
public static function dns_start()
{
if (config::byKey('ngrok::addr') == '') {
return;
}
network::dns_stop();
$config_file = '/tmp/ngrok_jeedom';
$logfile = log::getPathToLog('ngrok');
$uname = posix_uname();
if (strrpos($uname['machine'], 'arm') !== false) {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-arm';
} else {
if ($uname['machine'] == 'x86_64') {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-x64';
} else {
$cmd = dirname(__FILE__) . '/../../script/ngrok/ngrok-x86';
}
}
exec('chmod +x ' . $cmd);
$cmd .= ' -config=' . $config_file . ' start jeedom';
if (!self::dns_run()) {
$replace = array('#server_addr#' => 'dns.jeedom.com:4443', '#name#' => 'jeedom', '#proto#' => 'https', '#port#' => 80, '#remote_port#' => '', '#token#' => config::byKey('ngrok::token'), '#auth#' => '', '#subdomain#' => 'subdomain : ' . config::byKey('ngrok::addr'));
$config = template_replace($replace, file_get_contents(dirname(__FILE__) . '/../../script/ngrok/config'));
if (file_exists($config_file)) {
unlink($config_file);
}
file_put_contents($config_file, $config);
log::remove('ngrok');
log::add('ngork', 'debug', 'Lancement de ngork : ' . $cmd);
exec($cmd . ' >> /dev/null 2>&1 &');
}
return true;
}