mtdowling / cron-expression

CRON for PHP: Calculate the next or previous run date and determine if a CRON expression is due
http://mtdowling.com/blog/2012/06/03/cron-expressions-in-php/
MIT License
4.89k stars 339 forks source link

Trying to Schedule Specific Day cron jobs #45

Closed averybross closed 10 years ago

averybross commented 10 years ago

Hey, so when I feed Jobby "{"name":"52-excel-03\/12\/2014","command":"\/usr\/local\/bin\/php auto-excel-prep.php 52","schedule":"44 22 12 03 *","output":"log-excel.txt","enabled":"true"}"

and I get:

[12-Mar-2014 20:42:01 America/Denver] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message '00 9 is not a valid CRON expression' in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:105 Stack trace:

0 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(90): Cron\CronExpression->setExpression('00 9 ')

1 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(78): Cron\CronExpression->__construct('00 9 ', Object(Cron\FieldFactory))

2 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(180): Cron\CronExpression::factory('00 9 ')

3 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(67): Jobby\BackgroundJob->shouldRun()

4 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(304): Jobby\BackgroundJob->run()

5 {main}

thrown in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php on line 105 [12-Mar-2014 20:42:01 America/Denver] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message '42 20 is not a valid CRON expression' in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:105 Stack trace:

0 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(90): Cron\CronExpression->setExpression('42 20 ')

1 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(78): Cron\CronExpression->__construct('42 20 ', Object(Cron\FieldFactory))

2 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(180): Cron\CronExpression::factory('42 20 ')

3 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(67): Jobby\BackgroundJob->shouldRun()

4 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(304): Jobby\BackgroundJob->run()

5 {main}

thrown in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php on line 105 [12-Mar-2014 20:42:02 America/Denver] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message '42 -1 is not a valid CRON expression' in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:105 Stack trace:

0 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(90): Cron\CronExpression->setExpression('42 -1 ')

1 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(78): Cron\CronExpression->__construct('42 -1 ', Object(Cron\FieldFactory))

2 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(180): Cron\CronExpression::factory('42 -1 ')

3 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(67): Jobby\BackgroundJob->shouldRun()

4 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(304): Jobby\BackgroundJob->run()

5 {main}

thrown in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php on line 105 [12-Mar-2014 20:42:02 America/Denver] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message '42 3 is not a valid CRON expression' in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:105 Stack trace:

0 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(90): Cron\CronExpression->setExpression('42 3 ')

1 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(78): Cron\CronExpression->__construct('42 3 ', Object(Cron\FieldFactory))

2 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(180): Cron\CronExpression::factory('42 3 ')

3 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(67): Jobby\BackgroundJob->shouldRun()

4 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(304): Jobby\BackgroundJob->run()

5 {main}

thrown in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php on line 105 [12-Mar-2014 20:42:02 America/Denver] PHP Fatal error: Uncaught exception 'InvalidArgumentException' with message '42 6 is not a valid CRON expression' in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php:105 Stack trace:

0 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(90): Cron\CronExpression->setExpression('42 6 ')

1 /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php(78): Cron\CronExpression->__construct('42 6 ', Object(Cron\FieldFactory))

2 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(180): Cron\CronExpression::factory('42 6 ')

3 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(67): Jobby\BackgroundJob->shouldRun()

4 /home/brentst1/public_html/sociallev/respond/vendor/hellogerard/jobby/src/Jobby/BackgroundJob.php(304): Jobby\BackgroundJob->run()

5 {main}

thrown in /home/brentst1/public_html/sociallev/respond/vendor/mtdowling/cron-expression/src/Cron/CronExpression.php on line 105

mtdowling commented 10 years ago

Somehow it looks like "'00 9" was passed in as a cron expression. Seems like there's a problem somewhere else where the expression is being provided to the cron parser.