Jump to content
  • 0

Cron job problem with Direct Admin


sunrisepro

Question

I managed to delete my cronjob by mistake, now I'm having trouble setting up a cron job that works.

I know the url to php, after asking my host. My command looks like this:
 

Quote

 

/usr/local/php74/bin/php -q /home/username/domains/my_domain/public_html/subdomain/index.php > /dev/null 2>&1

 

 

 

I set it to go off every minute, I check /admin/settings/system/automation/ after 1 minute, and it still shows that cron last ran 2 days ago when I ran it manually. I'm not sure what's wrong.

Link to comment
Share on other sites

8 answers to this question

Recommended Posts

  • 0
On 6/7/2022 at 8:25 AM, sunrisepro said:

I'm stil stuck on this and have been running cron manually once a day. This is the path Blesta is showing in the Automation screen:

/usr/local/bin/php -q /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1

This is what my host recommended using, including the correct path to php 7.4 (which I confirmed is the version in use):

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php

My host also noted that the '-q' flag is outdated and should not be used.

I'm also trying these cronjobs:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1
/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php

All are set for 5 minutes, none are working. I'm happy to pay someone to resolve this for me as I'm lost on what could be wrong.

Based on this information, you should use:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1

If this doesn't work and you have SSH access you should try running it manually like this and see if it works:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron

This last command should output to your shell any output from the cron. Take note of what is output.

If it works, run the following command to check what your cron job actually is:

crontab -l

 

 

 

Link to comment
Share on other sites

  • 0
1 hour ago, sunrisepro said:

I managed to delete my cronjob by mistake, now I'm having trouble setting up a cron job that works.

I know the url to php, after asking my host. My command looks like this:
 

I set it to go off every minute, I check /admin/settings/system/automation/ after 1 minute, and it still shows that cron last ran 2 days ago when I ran it manually. I'm not sure what's wrong.

The cron should only run every 5 minutes, if it runs every minute it will be ignored. I realize you were probably just testing to see if it was working. Blesta does a generally pretty good idea of determining the command which you can see under Settings > System > Automation. Sometimes the path to PHP is wrong.

If your path to PHP is right, as well as the path to your cron, then your CLI PHP may be missing system requirements. You can check your logs under ../logs_blesta/ for any errors (Path defined under Settings > System > General) and you can, if you have SSH access, try running the cron command manually without sending the output to dev null. To run it via SSH, the command would look something like this based on what you provided:

/usr/local/php74/bin/php /home/username/domains/my_domain/public_html/subdomain/index.php

The most common problem is that the CLI version is missing ioncube or some other dependency.

Link to comment
Share on other sites

  • 0
19 minutes ago, Paul said:

Blesta does a generally pretty good idea of determining the command which you can see under Settings > System > Automation. Sometimes the path to PHP is wrong.

The url is the correct path to Blesta's index.php - that's what should be accessed for the cron job?

20 minutes ago, Paul said:

If your path to PHP is right, as well as the path to your cron, then your CLI PHP may be missing system requirements.

This is not an issue, it was working fine for well over a year before I deleted the cron job by mistake last week.

Link to comment
Share on other sites

  • 0
46 minutes ago, sunrisepro said:

The url is the correct path to Blesta's index.php - that's what should be accessed for the cron job?

This is not an issue, it was working fine for well over a year before I deleted the cron job by mistake last week.

The example Blesta shows under Settings > System > Automation is usually correct. Sometimes your path to PHP will be different, but it usually does a good job of detecting it.

If you deleted your cron job and don't remember what command you were using, probably you were calling a different version of PHP and that version met the system requirements while the new version does not.

Link to comment
Share on other sites

  • 0

I'm stil stuck on this and have been running cron manually once a day. This is the path Blesta is showing in the Automation screen:

/usr/local/bin/php -q /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1

This is what my host recommended using, including the correct path to php 7.4 (which I confirmed is the version in use):

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php

My host also noted that the '-q' flag is outdated and should not be used.

I'm also trying these cronjobs:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1
/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php

All are set for 5 minutes, none are working. I'm happy to pay someone to resolve this for me as I'm lost on what could be wrong.

Link to comment
Share on other sites

  • 0
2 hours ago, Paul said:

Based on this information, you should use:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1

That exact cron job has been there since my last comment so it's been active for 6 days and cron still needs to be run manually. I'm looking into SSH access to my VPS.

I'm also using Blesta 5.02 - does that affect anything?

Link to comment
Share on other sites

  • 0
30 minutes ago, sunrisepro said:

That exact cron job has been there since my last comment so it's been active for 6 days and cron still needs to be run manually. I'm looking into SSH access to my VPS.

I'm also using Blesta 5.02 - does that affect anything?

5.4.1 is the latest. It's possible that 5.0.2 does not have full compatibility with PHP 7.4, but I'm doubtful that is the issue here. If you can get SSH access and run that command via SSH it will tell us quite a bit.

Link to comment
Share on other sites

  • 0
On 6/13/2022 at 12:49 PM, Paul said:

Based on this information, you should use:

/usr/local/php74/bin/php /home/username/domains/domain.com/public_html/subdomain/index.php cron > /dev/null 2>&1

This one works now, after I removed a couple of the other cron jobs that were similar. It looks like cron is running once per hour.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...