Lumen Scheduler not working using cron jobs
i'm trying to run lumen scheduler and i have used crontab for this purpose and setup a command like this
* * * * * cd /home/humzayun/fbapp && ea-php71 artisan schedule:run >> /dev/null 2>&1
before this i tried using
* * * * * cd /home/humzayun/fbapp && php artisan schedule:run >> /dev/null 2>&1
but in log file it was throwing errors
[2018-11-13 16:31:03] staging.ERROR: ErrorException: Undefined index:
argv in
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53
Stack trace:
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} {"exception":"[object] (ErrorException(code: 0): Undefined index: argv at
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53)
[stacktrace]
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} "}
So after trying this all finally now my crontab is doing nothing.
my code in Kernel.php is
<?php
namespace AppConsole;
use FacebookFacebook;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
use PharIoManifestEmail;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function (Facebook $facebook){
Log::info($facebook->getDefaultAccessToken());
echo " yayy here ";
})->everyMinute();
}
}
Now the issue is that log is reporting nothing.
but when i run this command using ssh it output
http://prntscr.com/lhxxjq
and my lumen log file shows
http://prntscr.com/lhxy4g
But by this cron command nothing is working out like i'm doing in ssh.
Any help will be regraded i shall be very thankful to you for help
php laravel cron lumen
add a comment |
i'm trying to run lumen scheduler and i have used crontab for this purpose and setup a command like this
* * * * * cd /home/humzayun/fbapp && ea-php71 artisan schedule:run >> /dev/null 2>&1
before this i tried using
* * * * * cd /home/humzayun/fbapp && php artisan schedule:run >> /dev/null 2>&1
but in log file it was throwing errors
[2018-11-13 16:31:03] staging.ERROR: ErrorException: Undefined index:
argv in
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53
Stack trace:
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} {"exception":"[object] (ErrorException(code: 0): Undefined index: argv at
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53)
[stacktrace]
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} "}
So after trying this all finally now my crontab is doing nothing.
my code in Kernel.php is
<?php
namespace AppConsole;
use FacebookFacebook;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
use PharIoManifestEmail;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function (Facebook $facebook){
Log::info($facebook->getDefaultAccessToken());
echo " yayy here ";
})->everyMinute();
}
}
Now the issue is that log is reporting nothing.
but when i run this command using ssh it output
http://prntscr.com/lhxxjq
and my lumen log file shows
http://prntscr.com/lhxy4g
But by this cron command nothing is working out like i'm doing in ssh.
Any help will be regraded i shall be very thankful to you for help
php laravel cron lumen
add a comment |
i'm trying to run lumen scheduler and i have used crontab for this purpose and setup a command like this
* * * * * cd /home/humzayun/fbapp && ea-php71 artisan schedule:run >> /dev/null 2>&1
before this i tried using
* * * * * cd /home/humzayun/fbapp && php artisan schedule:run >> /dev/null 2>&1
but in log file it was throwing errors
[2018-11-13 16:31:03] staging.ERROR: ErrorException: Undefined index:
argv in
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53
Stack trace:
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} {"exception":"[object] (ErrorException(code: 0): Undefined index: argv at
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53)
[stacktrace]
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} "}
So after trying this all finally now my crontab is doing nothing.
my code in Kernel.php is
<?php
namespace AppConsole;
use FacebookFacebook;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
use PharIoManifestEmail;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function (Facebook $facebook){
Log::info($facebook->getDefaultAccessToken());
echo " yayy here ";
})->everyMinute();
}
}
Now the issue is that log is reporting nothing.
but when i run this command using ssh it output
http://prntscr.com/lhxxjq
and my lumen log file shows
http://prntscr.com/lhxy4g
But by this cron command nothing is working out like i'm doing in ssh.
Any help will be regraded i shall be very thankful to you for help
php laravel cron lumen
i'm trying to run lumen scheduler and i have used crontab for this purpose and setup a command like this
* * * * * cd /home/humzayun/fbapp && ea-php71 artisan schedule:run >> /dev/null 2>&1
before this i tried using
* * * * * cd /home/humzayun/fbapp && php artisan schedule:run >> /dev/null 2>&1
but in log file it was throwing errors
[2018-11-13 16:31:03] staging.ERROR: ErrorException: Undefined index:
argv in
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53
Stack trace:
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} {"exception":"[object] (ErrorException(code: 0): Undefined index: argv at
/home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php:53)
[stacktrace]
0 /home/humzayun/fbapp/vendor/symfony/console/Input/ArgvInput.php(53):
LaravelLumenApplication->LaravelLumenConcerns{closure}(8,
'Undefined index...', '/home/humzayun/...', 53, Array)
1 /home/humzayun/fbapp/artisan(34): SymfonyComponentConsoleInputArgvInput->__construct()
2 {main} "}
So after trying this all finally now my crontab is doing nothing.
my code in Kernel.php is
<?php
namespace AppConsole;
use FacebookFacebook;
use IlluminateConsoleSchedulingSchedule;
use LaravelLumenConsoleKernel as ConsoleKernel;
use PharIoManifestEmail;
class Kernel extends ConsoleKernel
{
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands = [
//
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->call(function (Facebook $facebook){
Log::info($facebook->getDefaultAccessToken());
echo " yayy here ";
})->everyMinute();
}
}
Now the issue is that log is reporting nothing.
but when i run this command using ssh it output
http://prntscr.com/lhxxjq
and my lumen log file shows
http://prntscr.com/lhxy4g
But by this cron command nothing is working out like i'm doing in ssh.
Any help will be regraded i shall be very thankful to you for help
php laravel cron lumen
php laravel cron lumen
asked Nov 13 '18 at 18:19
John StephenJohn Stephen
31
31
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
You'll receive these argv
errors when you're not executing the cli version of php. You should see (cli)
when executing php -v
:
# php -v
PHP 7.1.20 (cli) (built: Jul 25 2018 10:06:40) ( NTS )
If you see cgi or fcgi, then you're using the wrong binary.
When running commands in cron, it's best not to always redirect output to /dev/null and instead collect the stderr and stdout to review for errors. As indicated in the comments, ea-php71
was not in the $PATH
. Using the full path to ea-php71
solved the OP's problem.
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to theea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sureea-php71
lives in the$PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path toea-php71
to rule out path issues.
– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
|
show 4 more comments
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53287255%2flumen-scheduler-not-working-using-cron-jobs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
You'll receive these argv
errors when you're not executing the cli version of php. You should see (cli)
when executing php -v
:
# php -v
PHP 7.1.20 (cli) (built: Jul 25 2018 10:06:40) ( NTS )
If you see cgi or fcgi, then you're using the wrong binary.
When running commands in cron, it's best not to always redirect output to /dev/null and instead collect the stderr and stdout to review for errors. As indicated in the comments, ea-php71
was not in the $PATH
. Using the full path to ea-php71
solved the OP's problem.
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to theea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sureea-php71
lives in the$PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path toea-php71
to rule out path issues.
– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
|
show 4 more comments
You'll receive these argv
errors when you're not executing the cli version of php. You should see (cli)
when executing php -v
:
# php -v
PHP 7.1.20 (cli) (built: Jul 25 2018 10:06:40) ( NTS )
If you see cgi or fcgi, then you're using the wrong binary.
When running commands in cron, it's best not to always redirect output to /dev/null and instead collect the stderr and stdout to review for errors. As indicated in the comments, ea-php71
was not in the $PATH
. Using the full path to ea-php71
solved the OP's problem.
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to theea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sureea-php71
lives in the$PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path toea-php71
to rule out path issues.
– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
|
show 4 more comments
You'll receive these argv
errors when you're not executing the cli version of php. You should see (cli)
when executing php -v
:
# php -v
PHP 7.1.20 (cli) (built: Jul 25 2018 10:06:40) ( NTS )
If you see cgi or fcgi, then you're using the wrong binary.
When running commands in cron, it's best not to always redirect output to /dev/null and instead collect the stderr and stdout to review for errors. As indicated in the comments, ea-php71
was not in the $PATH
. Using the full path to ea-php71
solved the OP's problem.
You'll receive these argv
errors when you're not executing the cli version of php. You should see (cli)
when executing php -v
:
# php -v
PHP 7.1.20 (cli) (built: Jul 25 2018 10:06:40) ( NTS )
If you see cgi or fcgi, then you're using the wrong binary.
When running commands in cron, it's best not to always redirect output to /dev/null and instead collect the stderr and stdout to review for errors. As indicated in the comments, ea-php71
was not in the $PATH
. Using the full path to ea-php71
solved the OP's problem.
edited Nov 13 '18 at 18:56
answered Nov 13 '18 at 18:24
DevonDevon
22.6k42646
22.6k42646
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to theea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sureea-php71
lives in the$PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path toea-php71
to rule out path issues.
– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
|
show 4 more comments
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to theea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sureea-php71
lives in the$PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path toea-php71
to rule out path issues.
– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
prntscr.com/lhy1au Yes i can see CLI written in my php command i'm using
– John Stephen
Nov 13 '18 at 18:26
Ok, so your error messages are unrelated to the
ea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sure ea-php71
lives in the $PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path to ea-php71
to rule out path issues.– Devon
Nov 13 '18 at 18:29
Ok, so your error messages are unrelated to the
ea-php71
attempt then? Avoid asking multiple things and including multiple problems in one question for future, but make sure ea-php71
lives in the $PATH
for your cronjob and look at your crond log files to check for errors. You may consider trying to use the full path to ea-php71
to rule out path issues.– Devon
Nov 13 '18 at 18:29
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
i'm trying to do this but i can't find any cron logs. Where are cron logs ?
– John Stephen
Nov 13 '18 at 18:32
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Depends on the OS and what cron daemon you're running. Do you manage the server? Do you have a sysadmin to reach out to? You can see the output of this command by redirecting the stderr/stdout to a file instead of /dev/null.
– Devon
Nov 13 '18 at 18:39
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
Thanks its working fine now by using full path of ea-php71 :)
– John Stephen
Nov 13 '18 at 18:40
|
show 4 more comments
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53287255%2flumen-scheduler-not-working-using-cron-jobs%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown