need help in cron job execution for cpanel php script

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite
1












I am trying to write a cron job, I created a php file which will run every Tuesday and Sunday.



To test this I created a cron job which runs every 5 minutes. I have written a mail function inside it, but it looks like the cron job is not working as I have also updated my email id for the notification purpose.



Here is my cron job code and my php code:



3 * * * * php -q /home/jxxjordan/public_html/ospb2b/mycrons/depature.php


My php code:



$to = 'routemate.tech@gmail.com';
$subject = 'Marriage Proposal';
$message = 'Hi Jane, will you marry me?';
$from = 'depature@routemate.in';

// Sending email
if(mail($to, $subject, $message))
echo 'Your mail has been sent successfully.';
else
echo 'Unable to send email. Please try again.';



Is there anything wrong I am doing. I have got the cron job code from the in motion hosting forum.







share|improve this question






















  • Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
    – Marco
    Nov 27 '17 at 12:43











  • it started working. thanks sir @Marco
    – Ravi Jordan
    Nov 27 '17 at 12:57










  • Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
    – David Favor
    Nov 27 '17 at 13:04














up vote
0
down vote

favorite
1












I am trying to write a cron job, I created a php file which will run every Tuesday and Sunday.



To test this I created a cron job which runs every 5 minutes. I have written a mail function inside it, but it looks like the cron job is not working as I have also updated my email id for the notification purpose.



Here is my cron job code and my php code:



3 * * * * php -q /home/jxxjordan/public_html/ospb2b/mycrons/depature.php


My php code:



$to = 'routemate.tech@gmail.com';
$subject = 'Marriage Proposal';
$message = 'Hi Jane, will you marry me?';
$from = 'depature@routemate.in';

// Sending email
if(mail($to, $subject, $message))
echo 'Your mail has been sent successfully.';
else
echo 'Unable to send email. Please try again.';



Is there anything wrong I am doing. I have got the cron job code from the in motion hosting forum.







share|improve this question






















  • Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
    – Marco
    Nov 27 '17 at 12:43











  • it started working. thanks sir @Marco
    – Ravi Jordan
    Nov 27 '17 at 12:57










  • Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
    – David Favor
    Nov 27 '17 at 13:04












up vote
0
down vote

favorite
1









up vote
0
down vote

favorite
1






1





I am trying to write a cron job, I created a php file which will run every Tuesday and Sunday.



To test this I created a cron job which runs every 5 minutes. I have written a mail function inside it, but it looks like the cron job is not working as I have also updated my email id for the notification purpose.



Here is my cron job code and my php code:



3 * * * * php -q /home/jxxjordan/public_html/ospb2b/mycrons/depature.php


My php code:



$to = 'routemate.tech@gmail.com';
$subject = 'Marriage Proposal';
$message = 'Hi Jane, will you marry me?';
$from = 'depature@routemate.in';

// Sending email
if(mail($to, $subject, $message))
echo 'Your mail has been sent successfully.';
else
echo 'Unable to send email. Please try again.';



Is there anything wrong I am doing. I have got the cron job code from the in motion hosting forum.







share|improve this question














I am trying to write a cron job, I created a php file which will run every Tuesday and Sunday.



To test this I created a cron job which runs every 5 minutes. I have written a mail function inside it, but it looks like the cron job is not working as I have also updated my email id for the notification purpose.



Here is my cron job code and my php code:



3 * * * * php -q /home/jxxjordan/public_html/ospb2b/mycrons/depature.php


My php code:



$to = 'routemate.tech@gmail.com';
$subject = 'Marriage Proposal';
$message = 'Hi Jane, will you marry me?';
$from = 'depature@routemate.in';

// Sending email
if(mail($to, $subject, $message))
echo 'Your mail has been sent successfully.';
else
echo 'Unable to send email. Please try again.';



Is there anything wrong I am doing. I have got the cron job code from the in motion hosting forum.









share|improve this question













share|improve this question




share|improve this question








edited Nov 27 '17 at 12:43









Marco

768616




768616










asked Nov 27 '17 at 12:29









Ravi Jordan

11




11











  • Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
    – Marco
    Nov 27 '17 at 12:43











  • it started working. thanks sir @Marco
    – Ravi Jordan
    Nov 27 '17 at 12:57










  • Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
    – David Favor
    Nov 27 '17 at 13:04
















  • Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
    – Marco
    Nov 27 '17 at 12:43











  • it started working. thanks sir @Marco
    – Ravi Jordan
    Nov 27 '17 at 12:57










  • Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
    – David Favor
    Nov 27 '17 at 13:04















Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
– Marco
Nov 27 '17 at 12:43





Do you have errors in the logfile of the mail program (Something like /var/log/mail.log) or php? Also be aware that the script only runs at 3 minutes past the hour. For very 5 minutes you must replace the 3 by */05.
– Marco
Nov 27 '17 at 12:43













it started working. thanks sir @Marco
– Ravi Jordan
Nov 27 '17 at 12:57




it started working. thanks sir @Marco
– Ravi Jordan
Nov 27 '17 at 12:57












Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
– David Favor
Nov 27 '17 at 13:04




Best to also just manually execute your departure.php script on the command line + verify all's well. Also append something like the following to your cronjob to capture output.... >> /var/log/departure.log 2>&1
– David Favor
Nov 27 '17 at 13:04















active

oldest

votes











Your Answer







StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
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',
convertImagesToLinks: false,
noModals: false,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);



);













 

draft saved


draft discarded


















StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407277%2fneed-help-in-cron-job-execution-for-cpanel-php-script%23new-answer', 'question_page');

);

Post as a guest



































active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes















 

draft saved


draft discarded















































 


draft saved


draft discarded














StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f407277%2fneed-help-in-cron-job-execution-for-cpanel-php-script%23new-answer', 'question_page');

);

Post as a guest













































































Popular posts from this blog

How to check contact read email or not when send email to Individual?

Bahrain

Postfix configuration issue with fips on centos 7; mailgun relay