From 43fa4358c2dce758fa4385017e02c1e77a07429c Mon Sep 17 00:00:00 2001 From: Sebastian Grewe Date: Mon, 30 Sep 2013 09:46:34 +0200 Subject: [PATCH] [IMPROVED] Allow running crons with full path Crons can now be called from any directory and will be executed inside their working directory. Allows for more flexibility, e.g. taking out the statistics cron and running it directly. --- cronjobs/archive_cleanup.php | 3 +++ cronjobs/auto_payout.php | 3 +++ cronjobs/blockupdate.php | 3 +++ cronjobs/findblock.php | 3 +++ cronjobs/manual_payout.php | 3 +++ cronjobs/notifications.php | 3 +++ cronjobs/pplns_payout.php | 3 +++ cronjobs/pps_payout.php | 3 +++ cronjobs/proportional_payout.php | 3 +++ cronjobs/run-crons.sh | 2 +- cronjobs/statistics.php | 3 +++ cronjobs/tickerupdate.php | 3 +++ 12 files changed, 34 insertions(+), 1 deletion(-) diff --git a/cronjobs/archive_cleanup.php b/cronjobs/archive_cleanup.php index ebdd5b7e..9910979f 100755 --- a/cronjobs/archive_cleanup.php +++ b/cronjobs/archive_cleanup.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/auto_payout.php b/cronjobs/auto_payout.php index 5d646185..c65a18ce 100755 --- a/cronjobs/auto_payout.php +++ b/cronjobs/auto_payout.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/blockupdate.php b/cronjobs/blockupdate.php index e11063bb..bd489c04 100755 --- a/cronjobs/blockupdate.php +++ b/cronjobs/blockupdate.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/findblock.php b/cronjobs/findblock.php index eb19bd41..114d117b 100755 --- a/cronjobs/findblock.php +++ b/cronjobs/findblock.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/manual_payout.php b/cronjobs/manual_payout.php index 094d4c02..befd720a 100755 --- a/cronjobs/manual_payout.php +++ b/cronjobs/manual_payout.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/notifications.php b/cronjobs/notifications.php index 4a8931d6..8e3ac98a 100755 --- a/cronjobs/notifications.php +++ b/cronjobs/notifications.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/pplns_payout.php b/cronjobs/pplns_payout.php index c71f5659..8c83b28d 100755 --- a/cronjobs/pplns_payout.php +++ b/cronjobs/pplns_payout.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/pps_payout.php b/cronjobs/pps_payout.php index a02b8fd2..553228c1 100755 --- a/cronjobs/pps_payout.php +++ b/cronjobs/pps_payout.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/proportional_payout.php b/cronjobs/proportional_payout.php index a591da22..e6e76113 100755 --- a/cronjobs/proportional_payout.php +++ b/cronjobs/proportional_payout.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/run-crons.sh b/cronjobs/run-crons.sh index 193e0f7e..c4877c8f 100755 --- a/cronjobs/run-crons.sh +++ b/cronjobs/run-crons.sh @@ -63,7 +63,7 @@ fi # Find scripts path if [[ -L $0 ]]; then CRONHOME=$( dirname $( readlink $0 ) ) -else +else CRONHOME=$( dirname $0 ) fi diff --git a/cronjobs/statistics.php b/cronjobs/statistics.php index 8894b1a7..9228095b 100755 --- a/cronjobs/statistics.php +++ b/cronjobs/statistics.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php'); diff --git a/cronjobs/tickerupdate.php b/cronjobs/tickerupdate.php index 875be2b2..6afff97d 100755 --- a/cronjobs/tickerupdate.php +++ b/cronjobs/tickerupdate.php @@ -19,6 +19,9 @@ limitations under the License. */ +// Change to working directory +chdir(dirname(__FILE__)); + // Include all settings and classes require_once('shared.inc.php');