本文整理汇总了PHP中cron::setTimeout方法的典型用法代码示例。如果您正苦于以下问题:PHP cron::setTimeout方法的具体用法?PHP cron::setTimeout怎么用?PHP cron::setTimeout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类cron
的用法示例。
在下文中一共展示了cron::setTimeout方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: sonos3_update
function sonos3_update()
{
$cron = cron::byClassAndFunction('sonos3', 'pull');
if (!is_object($cron)) {
$cron = new cron();
}
$cron->setClass('sonos3');
$cron->setFunction('pull');
$cron->setEnable(1);
$cron->setDeamon(1);
$cron->setDeamonSleepTime(5);
$cron->setTimeout(1440);
$cron->setSchedule('* * * * *');
$cron->save();
$cron->stop();
foreach (sonos3::byType('sonos3') as $sonos) {
$sonos->save();
}
$files = array('24 LED Bright.ttf', '24 LED Grid.ttf', '24 LED Modul.ttf', '24 LED.ttf', 'advanced_dot_digital-7.ttf', 'AHDN.ttf', 'alpha04.ttf', 'CUBS LED TFB.ttf', 'enhanced_led_board-7.ttf', 'led_counter-7.ttf', 'liquid_crystal_display.ttf', 'liquid.ttf');
foreach ($files as $file) {
$path = dirname(__FILE__) . '/../core/template/fonts/' . $file;
if (file_exists($path)) {
unlink($path);
}
}
}
示例2: openzwave_update
function openzwave_update()
{
if (openzwave::deamonRunning()) {
echo 'Stop zwave network...';
openzwave::stopDeamon();
echo "OK\n";
}
echo 'Stop cron...';
$cron = cron::byClassAndFunction('openzwave', 'pull');
if (config::byKey('jeeNetwork::mode') != 'slave') {
if (!is_object($cron)) {
$cron = new cron();
}
$cron->setClass('openzwave');
$cron->setFunction('pull');
$cron->setEnable(1);
$cron->setDeamon(1);
$cron->setDeamonSleepTime(0.5);
$cron->setTimeout(1440);
$cron->setSchedule('* * * * *');
$cron->save();
$cron->stop();
} else {
if (is_object($cron)) {
$cron->remove();
}
}
echo "OK\n";
echo 'Check zwave system...';
if (count(eqLogic::byType('zwave')) > 0) {
log::add('openzwave', 'error', 'Attention vous etes sur la nouvelle version d\'openzwave, des actions de votre part sont necessaire merci d\'aller voir https://jeedom.fr/blog/?p=1576');
}
if (config::byKey('port', 'openzwave', 'none') != 'none') {
if (method_exists('openzwave', 'getVersion')) {
if (version_compare(config::byKey('openzwave_version', 'openzwave'), openzwave::getVersion('openzwave'), '>')) {
if (jeedom::getHardwareName() == 'Jeedomboard') {
config::save('allowStartDeamon', 0, 'openzwave');
openzwave::updateOpenzwave(false);
config::save('allowStartDeamon', 1, 'openzwave');
} else {
log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur le démon local, il faut ABSOLUMENT la mettre à jour', __FILE__));
}
}
}
}
if (config::byKey('jeeNetwork::mode') == 'master') {
foreach (jeeNetwork::byPlugin('openzwave') as $jeeNetwork) {
try {
if ($jeeNetwork->configByKey('port', 'openzwave', 'none') != 'none') {
if (version_compare($jeeNetwork->sendRawRequest('getVersion', array('plugin' => 'openzwave', 'module' => 'openzwave')), openzwave::getVersion('openzwave'), '>')) {
log::add('openzwave', 'error', __('Attention votre version d\'openzwave est dépassée sur', __FILE__) . ' ' . $jeeNetwork->getName() . ' ' . __('il faut ABSOLUMENT la mettre à jour', __FILE__));
}
}
} catch (Exception $e) {
}
}
}
echo "OK\n";
}
示例3: zwave_update
function zwave_update()
{
$cron = cron::byClassAndFunction('zwave', 'pull');
if (config::byKey('jeeNetwork::mode') != 'slave') {
if (!is_object($cron)) {
$cron = new cron();
}
$cron->setClass('zwave');
$cron->setFunction('pull');
$cron->setEnable(1);
$cron->setDeamon(1);
$cron->setTimeout(1440);
$cron->setSchedule('* * * * *');
$cron->save();
$cron->stop();
} else {
if (is_object($cron)) {
$cron->remove();
}
}
foreach (zwave::byType('zwave') as $zwave) {
if ($zwave->getConfiguration('serverID') == '') {
$zwave->setConfiguration('serverID', 1);
}
$zwave->save();
}
config::save('zwaveAddr1', config::byKey('zwaveAddr1', 'zwave', config::byKey('zwaveAddr', 'zwave')), 'zwave');
config::save('zwavePort1', config::byKey('zwavePort1', 'zwave', config::byKey('zwavePort', 'zwave')), 'zwave');
config::save('isOpenZwave1', config::byKey('isOpenZwave1', 'zwave', config::byKey('isOpenZwave', 'zwave')), 'zwave');
if (method_exists('zwave', 'listServerZway')) {
foreach (zwave::listServerZway() as $serverID => $server) {
if (config::byKey('lastNotificationCheck' . $serverID, 'zwave', 0) == 0) {
config::save('lastNotificationCheck' . $serverID, strtotime('now'), 'zwave');
}
}
}
}
示例4: cron
$cron = new cron();
}
$cron->setClass('plugin');
$cron->setFunction('cron15');
$cron->setSchedule('*/15 * * * * *');
$cron->setTimeout(60);
$cron->save();
$cron = cron::byClassAndFunction('plugin', 'cron30');
if (!is_object($cron)) {
echo "Création de plugin::cron30\n";
$cron = new cron();
}
$cron->setClass('plugin');
$cron->setFunction('cron30');
$cron->setSchedule('*/30 * * * * *');
$cron->setTimeout(60);
$cron->save();
$dynamic_apache_path = dirname(__FILE__) . '/../core/config/apache_jeedom_dynamic_rules';
if (!file_exists($dynamic_apache_path)) {
touch($dynamic_apache_path);
}
if (jeedom::isCapable('sudo')) {
if (!file_exists('/var/log/auth.log')) {
exec('sudo touch /var/log/auth.log');
exec('sudo service fail2ban restart');
}
exec('sudo service cron restart');
}
cache::deleteBySearch('widgetHtml');
cache::deleteBySearch('cmdWidgetdashboard');
cache::deleteBySearch('cmdWidgetmobile');
示例5: cron
<?php
$cron = cron::byClassAndFunction('plugin', 'cronDaily');
if (!is_object($cron)) {
$cron = new cron();
$cron->setClass('plugin');
$cron->setFunction('cronDaily');
$cron->setSchedule('00 00 * * * *');
$cron->setTimeout(5);
$cron->save();
}
$cron = cron::byClassAndFunction('plugin', 'cronHourly');
if (!is_object($cron)) {
$cron = new cron();
$cron->setClass('plugin');
$cron->setFunction('cronHourly');
$cron->setSchedule('00 * * * * *');
$cron->setTimeout(5);
$cron->save();
}
示例6: Exception
$object = object::byId($params['id']);
if (!is_object($object)) {
throw new Exception('Objet introuvable : ' . $params['id'], -32601);
}
$jsonrpc->makeSuccess(utils::o2a($object));
}
if ($jsonrpc->getMethod() == 'object::full') {
$cache = cache::byKey('api::object::full');
$cron = cron::byClassAndFunction('object', 'fullData');
if (!is_object($cron)) {
$cron = new cron();
}
$cron->setClass('object');
$cron->setFunction('fullData');
$cron->setSchedule('* * * * * 2000');
$cron->setTimeout(10);
$cron->save();
if (!$cron->running()) {
$cron->run(true);
}
if ($cache->getValue() != '') {
$jsonrpc->makeSuccess(json_decode($cache->getValue(), true));
}
$jsonrpc->makeSuccess(array());
}
if ($jsonrpc->getMethod() == 'object::fullById') {
$object = object::byId($params['id']);
if (!is_object($object)) {
throw new Exception('Objet introuvable : ' . $params['id'], -32601);
}
$return = utils::o2a($object);
示例7: changeMode
public static function changeMode($_mode)
{
switch ($_mode) {
case 'master':
if (config::byKey('jeeNetwork::mode') != 'master') {
$cron = new cron();
$cron->setClass('history');
$cron->setFunction('historize');
$cron->setSchedule('*/5 * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('scenario');
$cron->setFunction('check');
$cron->setSchedule('* * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('cmd');
$cron->setFunction('collect');
$cron->setSchedule('*/5 * * * * *');
$cron->setTimeout(5);
$cron->save();
$cron = new cron();
$cron->setClass('history');
$cron->setFunction('archive');
$cron->setSchedule('00 * * * * *');
$cron->setTimeout(20);
$cron->save();
config::save('jeeNetwork::mode', 'master');
}
break;
case 'slave':
if (config::byKey('jeeNetwork::mode') != 'slave') {
foreach (eqLogic::all() as $eqLogic) {
$eqLogic->remove();
}
foreach (object::all() as $object) {
$object->remove();
}
foreach (update::all() as $update) {
switch ($update->getType()) {
case 'core':
break;
case 'plugin':
try {
$plugin = plugin::byId($update->getLogicalId());
if (is_object($plugin) && $plugin->getAllowRemote() != 1) {
$update->deleteObjet();
}
} catch (Exception $e) {
}
break;
default:
$update->deleteObjet();
break;
}
}
foreach (view::all() as $view) {
$view->remove();
}
foreach (plan::all() as $plan) {
$plan->remove();
}
foreach (scenario::all() as $scenario) {
$scenario->remove();
}
foreach (listener::all() as $listener) {
$listener->remove();
}
$cron = cron::byClassAndFunction('history', 'historize');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('scenario', 'check');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('cmd', 'collect');
if (is_object($cron)) {
$cron->remove();
}
$cron = cron::byClassAndFunction('history', 'archive');
if (is_object($cron)) {
$cron->remove();
}
$user = new user();
$user->setLogin('jeedom_master');
$user->setPassword(config::genKey(255));
$user->setRights('admin', 1);
$user->save();
config::save('jeeNetwork::mode', 'slave');
}
break;
}
}