From a33558a61efc244ad8c809748e6ee64413e3a217 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Mon, 2 Sep 2013 12:33:59 +0400 Subject: pass logfile to child tasks if locking is possible, lock logfile before writing, add kludge to prevent update_rss_feed unneeded debugging go into master logfile --- update_daemon2.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'update_daemon2.php') diff --git a/update_daemon2.php b/update_daemon2.php index 9d948a64d..e5bc55ee0 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -218,10 +218,11 @@ register_shutdown_function('task_shutdown'); $quiet = (isset($options["quiet"])) ? "--quiet" : ""; + $log = function_exists("flock") && isset($options['log']) ? '--log '.$options['log'] : ''; $my_pid = posix_getpid(); - passthru(PHP_EXECUTABLE . " update.php --daemon-loop $quiet --task $j --pidlock $my_pid"); + passthru(PHP_EXECUTABLE . " update.php --daemon-loop $quiet $log --task $j --pidlock $my_pid"); sleep(1); -- cgit v1.2.3-54-g00ecf From bd8ae98bde2320668972fd40e60f1866e86214dc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Wed, 18 Dec 2013 14:00:44 +0400 Subject: daemon: include functions before config to enable define_default support --- update_daemon2.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'update_daemon2.php') diff --git a/update_daemon2.php b/update_daemon2.php index e5bc55ee0..81734bc3c 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -9,9 +9,9 @@ define('DISABLE_SESSIONS', true); require_once "version.php"; - require_once "config.php"; require_once "autoload.php"; require_once "functions.php"; + require_once "config.php"; require_once "rssfuncs.php"; // defaults -- cgit v1.2.3-54-g00ecf From 6f61ba46c4a7d61c8e90252897b711573bbb36cc Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Feb 2014 23:03:05 +0400 Subject: detect php cgi binary because people keep trying to run service scripts using it --- update.php | 7 +++++++ update_daemon2.php | 7 +++++++ 2 files changed, 14 insertions(+) (limited to 'update_daemon2.php') diff --git a/update.php b/update.php index c1547fa7f..521b956ad 100755 --- a/update.php +++ b/update.php @@ -42,6 +42,13 @@ $options = getopt("", $longopts); + if (!is_array($options)) { + die("error: getopt() failed. ". + "Most probably you are using PHP CGI to run this script ". + "instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ". + "additional information.\n"); + } + if (count($options) == 0 && !defined('STDIN')) { ?> diff --git a/update_daemon2.php b/update_daemon2.php index 81734bc3c..9b8a7ad66 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -29,6 +29,13 @@ die("error: This script requires PHP compiled with PCNTL module.\n"); } + if (!is_array($options)) { + die("error: getopt() failed. ". + "Most probably you are using PHP CGI to run this script ". + "instead of required PHP CLI. Check tt-rss wiki page on updating feeds for ". + "additional information.\n"); + } + $master_handlers_installed = false; $children = array(); -- cgit v1.2.3-54-g00ecf From 45ce1610d284fd3234de973542722fdcfc29c4d3 Mon Sep 17 00:00:00 2001 From: Andrew Dolgov Date: Thu, 6 Feb 2014 23:04:27 +0400 Subject: fix previous on daemon2 --- update_daemon2.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'update_daemon2.php') diff --git a/update_daemon2.php b/update_daemon2.php index 9b8a7ad66..1dddf6efd 100755 --- a/update_daemon2.php +++ b/update_daemon2.php @@ -24,11 +24,12 @@ require_once "db.php"; require_once "db-prefs.php"; - if (!function_exists('pcntl_fork')) { die("error: This script requires PHP compiled with PCNTL module.\n"); } + $options = getopt(""); + if (!is_array($options)) { die("error: getopt() failed. ". "Most probably you are using PHP CGI to run this script ". @@ -36,6 +37,7 @@ "additional information.\n"); } + $master_handlers_installed = false; $children = array(); -- cgit v1.2.3-54-g00ecf