Laravel 5.7 schedule via cron on AWS EC2 linux ami - commands not running
I've created a cron job in AWS EC2 but it is not working at scheduled time.when i run command in cli php artisan schedule:run it is working fine but not execute automatically at scheduled time.
php version=7.2.11
laravel framwork = 5.7
I added cron entry in crontab using crontab -e
* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
This is my kernal file
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands=[
'AppConsoleCommandsExampleCronJob',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('example:mail:send')
->everyMinute();
}
laravel amazon-web-services amazon-ec2
|
show 3 more comments
I've created a cron job in AWS EC2 but it is not working at scheduled time.when i run command in cli php artisan schedule:run it is working fine but not execute automatically at scheduled time.
php version=7.2.11
laravel framwork = 5.7
I added cron entry in crontab using crontab -e
* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
This is my kernal file
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands=[
'AppConsoleCommandsExampleCronJob',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('example:mail:send')
->everyMinute();
}
laravel amazon-web-services amazon-ec2
What's the output ofwhich phpon your server?
– Mozammil
Jan 20 at 11:51
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
which phpwill output the path to your php executable. Just want to make sure you got the right one.
– Mozammil
Jan 20 at 12:13
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
1
Just typewhich phpin your terminal while logged in to your server and let us know the output. It should show something like/usr/local/bin/phpor/usr/bin/php
– Mozammil
Jan 20 at 12:19
|
show 3 more comments
I've created a cron job in AWS EC2 but it is not working at scheduled time.when i run command in cli php artisan schedule:run it is working fine but not execute automatically at scheduled time.
php version=7.2.11
laravel framwork = 5.7
I added cron entry in crontab using crontab -e
* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
This is my kernal file
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands=[
'AppConsoleCommandsExampleCronJob',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('example:mail:send')
->everyMinute();
}
laravel amazon-web-services amazon-ec2
I've created a cron job in AWS EC2 but it is not working at scheduled time.when i run command in cli php artisan schedule:run it is working fine but not execute automatically at scheduled time.
php version=7.2.11
laravel framwork = 5.7
I added cron entry in crontab using crontab -e
* * * * * /usr/local/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
This is my kernal file
/**
* The Artisan commands provided by your application.
*
* @var array
*/
protected $commands=[
'AppConsoleCommandsExampleCronJob',
];
/**
* Define the application's command schedule.
*
* @param IlluminateConsoleSchedulingSchedule $schedule
* @return void
*/
protected function schedule(Schedule $schedule)
{
$schedule->command('example:mail:send')
->everyMinute();
}
laravel amazon-web-services amazon-ec2
laravel amazon-web-services amazon-ec2
asked Jan 20 at 11:38
paresh kalsariyaparesh kalsariya
6817
6817
What's the output ofwhich phpon your server?
– Mozammil
Jan 20 at 11:51
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
which phpwill output the path to your php executable. Just want to make sure you got the right one.
– Mozammil
Jan 20 at 12:13
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
1
Just typewhich phpin your terminal while logged in to your server and let us know the output. It should show something like/usr/local/bin/phpor/usr/bin/php
– Mozammil
Jan 20 at 12:19
|
show 3 more comments
What's the output ofwhich phpon your server?
– Mozammil
Jan 20 at 11:51
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
which phpwill output the path to your php executable. Just want to make sure you got the right one.
– Mozammil
Jan 20 at 12:13
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
1
Just typewhich phpin your terminal while logged in to your server and let us know the output. It should show something like/usr/local/bin/phpor/usr/bin/php
– Mozammil
Jan 20 at 12:19
What's the output of
which php on your server?– Mozammil
Jan 20 at 11:51
What's the output of
which php on your server?– Mozammil
Jan 20 at 11:51
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
which php will output the path to your php executable. Just want to make sure you got the right one.– Mozammil
Jan 20 at 12:13
which php will output the path to your php executable. Just want to make sure you got the right one.– Mozammil
Jan 20 at 12:13
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
1
1
Just type
which php in your terminal while logged in to your server and let us know the output. It should show something like /usr/local/bin/php or /usr/bin/php– Mozammil
Jan 20 at 12:19
Just type
which php in your terminal while logged in to your server and let us know the output. It should show something like /usr/local/bin/php or /usr/bin/php– Mozammil
Jan 20 at 12:19
|
show 3 more comments
1 Answer
1
active
oldest
votes
Based on our comments, the issue is with your PHP executable's path. The path is wrong in your cron job definition. Change it to:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
Assuming that the artisan executable is located at /var/www/html, that should fix it.
In case you are not sure if that's the correct path, you can type pwd from your project root (where artisan is located) to get the correct path to your artisan executable.
add a comment |
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%2f54276044%2flaravel-5-7-schedule-via-cron-on-aws-ec2-linux-ami-commands-not-running%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
Based on our comments, the issue is with your PHP executable's path. The path is wrong in your cron job definition. Change it to:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
Assuming that the artisan executable is located at /var/www/html, that should fix it.
In case you are not sure if that's the correct path, you can type pwd from your project root (where artisan is located) to get the correct path to your artisan executable.
add a comment |
Based on our comments, the issue is with your PHP executable's path. The path is wrong in your cron job definition. Change it to:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
Assuming that the artisan executable is located at /var/www/html, that should fix it.
In case you are not sure if that's the correct path, you can type pwd from your project root (where artisan is located) to get the correct path to your artisan executable.
add a comment |
Based on our comments, the issue is with your PHP executable's path. The path is wrong in your cron job definition. Change it to:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
Assuming that the artisan executable is located at /var/www/html, that should fix it.
In case you are not sure if that's the correct path, you can type pwd from your project root (where artisan is located) to get the correct path to your artisan executable.
Based on our comments, the issue is with your PHP executable's path. The path is wrong in your cron job definition. Change it to:
* * * * * /usr/bin/php /var/www/html/artisan schedule:run >> /dev/null 2>&1
Assuming that the artisan executable is located at /var/www/html, that should fix it.
In case you are not sure if that's the correct path, you can type pwd from your project root (where artisan is located) to get the correct path to your artisan executable.
edited Jan 20 at 12:50
answered Jan 20 at 12:34
MozammilMozammil
6,190419
6,190419
add a comment |
add a comment |
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%2f54276044%2flaravel-5-7-schedule-via-cron-on-aws-ec2-linux-ami-commands-not-running%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
What's the output of
which phpon your server?– Mozammil
Jan 20 at 11:51
php version is 7.2 and output will be nothing because command not execute at every-minute@Mozammil
– paresh kalsariya
Jan 20 at 12:12
which phpwill output the path to your php executable. Just want to make sure you got the right one.– Mozammil
Jan 20 at 12:13
i try with php7.2 in path but still not working@Mozammil
– paresh kalsariya
Jan 20 at 12:18
1
Just type
which phpin your terminal while logged in to your server and let us know the output. It should show something like/usr/local/bin/phpor/usr/bin/php– Mozammil
Jan 20 at 12:19