Giter VIP home page Giter VIP logo

Comments (17)

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

Hello, did you enable preventOverlapping?
Could post whole task file and output of command vendor/bin/crunz s:r -vvv --force?

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Would preventOverlapping be set in crunz.yml? It's not in there. Should it be enabled or disabled?

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Post the whole task file in the CLI? Not sure how to do that.

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

preventOverlapping is set per event/task, like $event->preventOverlapping().

Post the whole task file in the CLI? Not sure how to do that.

I mean post here, on GitHub :)

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Not using ->preventOverlapping(), should I? Not sure how it works. From the documentation, it seems it would prevent a file from running if another is running at the same time, right? So if I don't use it, they should work okay? Or should I use it for each task that runs at the same time, and then they'll run sequentially?

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

it seems it would prevent a file from running if another is running at the same time, right? So if I don't use it, they should work okay?

Right.

Please post your task file here.

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Okay, it's very involved though. To simplify, should I post only the tasks running at the same time? Some of them use functions, with variables from db, passed with use ().

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

Only PHP code of Crunz tasks.

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Thanks for looking. Here it is:

use Crunz\Schedule;

$schedule->run('/usr/bin/php renewalemail.php')
    ->daily()
    ->at("$continuetime")
	//->everyMinute()
	->sendOutputTo('log/cron_finishemails.log')
	->description('Continue emails daily until done, limited by Renewal Notice Criteria setting in renewalemail.php.')
	->when(function() use ($lastrenewid,&$cronrunning,$apcuAvailable,$nextqueue,$db){
		$thisjob = 1;
		if ($cronrunning==$thisjob) {
			return true;
		} elseif ($lastrenewid==0 && $cronrunning==0 && $nextqueue==$thisjob) {
			$stmt = $db->prepare('update control set cronrunning=?');
			$stmt->bind_param('i', $thisjob);
			$stmt->execute();
			$stmt->close();

			$cronrunning=$thisjob;
			if ($apcuAvailable) {
				apcu_store('cronrunning', $cronrunning);
		    }
			return true;
		} else { return false; }
	});

$schedule->run('/usr/bin/php bt_billing_notice.php')
    ->daily()
    ->at("$continuetime")
	//->everyMinute()
	->sendOutputTo('log/cron_finish_bill_notice.log')
	->description('Continue recurring billing notice emails daily until done, limited by setting in bt-bill-reminder.php.')
	->when(function() use ($lastrenewid,&$cronrunning,$nextqueue,$recurdate,$apcuAvailable,$db){
		$thisjob = 2;
		if ($recurdate==0) {
			return false;
		} elseif ($cronrunning==$thisjob) {
			return true;
		} elseif ($lastrenewid==0 && $cronrunning==0 && $nextqueue==$thisjob) {
			$stmt = $db->prepare('update control set cronrunning=?');
			$stmt->bind_param('i', $thisjob);
			$stmt->execute();
			$stmt->close();

			$cronrunning=$thisjob;
			if ($apcuAvailable) {
				apcu_store('cronrunning', $cronrunning);
		    }
			return true;
		} else { return false; }
	});

$schedule->run('/usr/bin/php pdfissueemail.php')
    ->daily()
    ->at("$continuetime")
	//->everyMinute()
	->sendOutputTo('log/cron_PDFemails.log')
	->description('Continue PDF emails daily until done, limited by Renewal Notice Criteria setting in renewalcriteria.php.')
	->when(function() use ($lastrenewid,&$cronrunning,$nextqueue,$apcuAvailable,$db){
		$thisjob = 3;
		if ($cronrunning==$thisjob) {
			return true;
		} elseif ($lastrenewid==0 && $cronrunning==0 && $nextqueue==$thisjob) {
			$stmt = $db->prepare('update control set cronrunning=?');
			$stmt->bind_param('i', $thisjob);
			$stmt->execute();
			$stmt->close();

			$cronrunning=$thisjob;
			if ($apcuAvailable) {
				apcu_store('cronrunning', $cronrunning);
		    }
			return true;
		} else { return false; }
	});

$schedule->run('/usr/bin/php customemail.php')
    ->daily()
    ->at("$continuetime")
	//->everyMinute()
	->sendOutputTo('log/cron_customemails.log')
	->description('Continue custom emails daily until done, limited by Renewal Notice Criteria setting in renewalcriteria.php.')
	->when(function() use ($lastrenewid,&$cronrunning,$nextqueue,$apcuAvailable,$db){
		$thisjob = 4;
		if ($cronrunning==$thisjob) {
			return true;
		} elseif ($lastrenewid==0 && $cronrunning==0 && $nextqueue==$thisjob) {
			$stmt = $db->prepare('update control set cronrunning=?');
			$stmt->bind_param('i', $thisjob);
			$stmt->execute();
			$stmt->close();

			$cronrunning=$thisjob;
			if ($apcuAvailable) {
				apcu_store('cronrunning', $cronrunning);
		    }
			return true;
		} else { return false; }
	});

$schedule->run('/usr/bin/php incompleteemail.php')
	->daily()
	->at("$continuetime")
	->sendOutputTo('log/cron_incompleteemail.log')
	->description('Pending sub reminder email.')
	->when(function() use ($pendingcronjob){
		if ($pendingcronjob) {	return true; }
	});

return $schedule;

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

Now, could you run vendor/bin/crunz s:r -vvv --force and paste output here?

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Here you go:

Using config file /var/www/subs.humortimes/crunz.yml.
Task source path '/var/www/subs.humortimes/tasks'
Task finder suffix: 'Tasks.php'
Realpath for '/var/www/subs.humortimes/tasks' is '/var/www/subs.humortimes/tasks'
Found 1 task(s) at path '/var/www/subs.humortimes/tasks'
Doing HumorTimesTasks.php.<br>apcuAvailable? 1<br>NOT using apcu<br>db crontab: 05 03 11 * *<BR>
db lastrenewid: 8824<BR>
db cronjob: 1<BR>
db cronqueue: <BR>
db cronrunning: 1<BR>
PHP Notice:  Undefined variable: nextqueue in /var/www/subs.humortimes/tasks/HumorTimesTasks.php on line 105
db nextqueue: <BR>
continuetime: 03:04<br>
added to apcu, fetch crontab: 05 03 11 * *<br>added to apcu, fetch continuetime: 03:04<br>before Finish Emails<BR>
before Fetchmail<BR>
Finished HumorTimesTasks.php.<br>Timezone from config: 'America/Los_Angeles'.
Timezone for comparisons: 'America/Los_Angeles'.
Invoke Schedule's ping before
There is no ping before url.
Class for 'logger_factory': 'Crunz\Infrastructure\Psr\Logger\PsrStreamLoggerFactory'.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping after.
There is no ping after url.

In PsrStreamLogger.php line 116:

  [Crunz\Exception\CrunzException]
  Stream path cannot be empty.


Exception trace:
  at /var/www/subs.humortimes/vendor/lavary/crunz/src/Infrastructure/Psr/Logger/PsrStreamLogger.php:116
 Crunz\Infrastructure\Psr\Logger\PsrStreamLogger->initializeHandler() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Infrastructure/Psr/Logger/PsrStreamLogger.php:96
 Crunz\Infrastructure\Psr\Logger\PsrStreamLogger->createInfoHandler() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Infrastructure/Psr/Logger/PsrStreamLogger.php:67
 Crunz\Infrastructure\Psr\Logger\PsrStreamLogger->log() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Infrastructure/Psr/Logger/EnabledLoggerDecorator.php:47
 Crunz\Infrastructure\Psr\Logger\EnabledLoggerDecorator->log() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Logger/Logger.php:37
 Crunz\Logger\Logger->log() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Logger/Logger.php:23
 Crunz\Logger\Logger->info() at /var/www/subs.humortimes/vendor/lavary/crunz/src/EventRunner.php:201
 Crunz\EventRunner->handleOutput() at /var/www/subs.humortimes/vendor/lavary/crunz/src/EventRunner.php:138
 Crunz\EventRunner->manageStartedEvents() at /var/www/subs.humortimes/vendor/lavary/crunz/src/EventRunner.php:74
 Crunz\EventRunner->handle() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Console/Command/ScheduleRunCommand.php:152
 Crunz\Console\Command\ScheduleRunCommand->execute() at /var/www/subs.humortimes/vendor/symfony/console/Command/Command.php:256
 Symfony\Component\Console\Command\Command->run() at /var/www/subs.humortimes/vendor/symfony/console/Application.php:971
 Symfony\Component\Console\Application->doRunCommand() at /var/www/subs.humortimes/vendor/symfony/console/Application.php:290
 Symfony\Component\Console\Application->doRun() at /var/www/subs.humortimes/vendor/symfony/console/Application.php:166
 Symfony\Component\Console\Application->run() at /var/www/subs.humortimes/vendor/lavary/crunz/src/Application.php:98
 Crunz\Application->run() at /var/www/subs.humortimes/vendor/lavary/crunz/crunz:71

schedule:run [-f|--force] [-t|--task TASK] [--] [<source>]

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

As you can see there are two issues, first:

PHP Notice: Undefined variable: nextqueue in /var/www/subs.humortimes/tasks/HumorTimesTasks.php on line 105

seems like error in task file, not in Crunz.

Second is:

In PsrStreamLogger.php line 116:

[Crunz\Exception\CrunzException]
Stream path cannot be empty.

and this can be Crunz error or wrong configuration.

Please post your configuration here.

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

I assume you mean the crunz.yml file. Here it is:

# Crunz Configuration Settings

# This option defines where the task files and
# directories reside.
# The path is relative to this config file.
# Trailing slashes will be ignored.
source: tasks

# The suffix is meant to target the task files inside the ":source" directory.
# Please note if you change this value, you need
# to make sure all the existing tasks files are renamed accordingly.
suffix: Tasks.php

# Timezone is used to calculate task run time
# This option is very important and not setting it is deprecated
# and will result in exception in 2.0 version.
timezone: America/Los_Angeles

# By default the errors are not logged by Crunz
# You may set the value to true for logging the errors
log_errors: false

# This is the absolute path to the errors' log file
# You need to make sure you have the required permission to write to this file though.
errors_log_file: /var/www/subs.humortimes/log/cron_errors.log

# By default the output is not logged as they are redirected to the
# null output.
# Set this to true if you want to keep the outputs
log_output: true

# This is the absolute path to the global output log file
# The events which have dedicated log files (defined with them), won't be
# logged to this file though.
output_log_file: ~

# By default line breaks in logs aren't allowed.
# Set the value to true to allow them.
log_allow_line_breaks: false

# This option determines whether the output should be emailed or not.
email_output: true

# This option determines whether the error messages should be emailed or not.
email_errors: true

# Global Swift Mailer settings
mailer:
    # Possible values: smtp, mail, and sendmail
    transport: smtp
    recipients:
    sender_name:
    sender_email:


# SMTP settings
smtp:
    host: ~
    port: ~
    username: ~
    password: ~
    encryption: ~

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

I assume you mean the crunz.yml file. Here it is:

Yep, the crunz.yml.
Looks like log_output is enabled, but there are null path in output_log_file. Try specifying log file and run Crunz again.

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Here you go:

Using config file /var/www/subs.humortimes/crunz.yml.
Task source path '/var/www/subs.humortimes/tasks'
Task finder suffix: 'Tasks.php'
Realpath for '/var/www/subs.humortimes/tasks' is '/var/www/subs.humortimes/tasks'
Found 1 task(s) at path '/var/www/subs.humortimes/tasks'
Doing HumorTimesTasks.php.<br>apcuAvailable? 1<br>NOT using apcu<br>db crontab: 05 03 11 * *<BR>
db lastrenewid: 0<BR>
db cronjob: 1<BR>
db cronqueue: 4<BR>
db cronrunning: 3<BR>
db nextqueue: 4<BR>
continuetime: 03:04<br>
added to apcu, fetch crontab: 05 03 11 * *<br>added to apcu, fetch continuetime: 03:04<br>before Finish Emails<BR>
before Fetchmail<BR>
Finished HumorTimesTasks.php.<br>Timezone from config: 'America/Los_Angeles'.
Timezone for comparisons: 'America/Los_Angeles'.
Invoke Schedule's ping before
There is no ping before url.
Class for 'logger_factory': 'Crunz\Infrastructure\Psr\Logger\PsrStreamLoggerFactory'.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping before.
There is no ping before url.
Invoke Event's ping after.
There is no ping after url.
Task TEST crontab variable. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Start a monthly renewal email, if cron enabled. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Continue emails daily until done, limited by Renewal Notice Criteria setting in renewalemail.php. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Start recurring billing notice emails. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Continue recurring billing notice emails daily until done, limited by setting in bt-bill-reminder.php. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Continue custom emails daily until done, limited by Renewal Notice Criteria setting in renewalcriteria.php. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Pending & recurring accounts change notice. status: success.
Invoke Event's ping after.
There is no ping after url.
Task Run bad-email-addr.php 15 minutes after fetchmail to trigger admin report. status: success.
Invoke Event's ping after.
There is no ping after url.
Task refresh variables in apcu status: success.
Invoke Event's ping after.
There is no ping after url.
Task Pending sub reminder email. status: success.
Task Fetchmail polls Omsoft email folder looking for remove requests and returned emails, and uses removemail.php. status: fail.
Invoke Event's ping after.
There is no ping after url.
Task Continue PDF emails daily until done, limited by Renewal Notice Criteria setting in renewalcriteria.php. status: success.
Invoke Schedule's ping after.
There is no ping after url.

from crunz.

PabloKowalczyk avatar PabloKowalczyk commented on July 16, 2024

Looks like one task failed: Task Fetchmail polls Omsoft email folder looking for remove requests and returned emails, and uses removemail.php. status: fail., i don't know why but it, for 99,99%, is not Crunz bug.

from crunz.

jamminjames avatar jamminjames commented on July 16, 2024

Okay, looks like all the other ones ran. Thanks!!!

from crunz.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.