Jump to content

Cron not working


Ninjakreborn

Recommended Posts

I have a file called email_cron.php.  I have verified that when I load this page in a browser it works fine.  I have it doing some email sending, then sending a master email to a specific email address saying what emails were sent. This is an update script for a website to give them notices every day. Regardless, I tested the script itself out and it works perfectly when ran normally. 

 

I had setup a cron for this. I thought the cron was working but it's been 3-4-5 days and they have had no emails. If I go in and test the script manually it works but the cron isn't doing something.  I am using 1and1.com for the hosting by the way. So I went back into the SSH and typed "crontab -l" and mine is listed. It is marked as

 

50 * * * * /kunden/usr/local/bin/php /kunden/homepages/##/#######/htdocs/email_cron.php

Replace the # with the id's of my site.  Which are the path structure.

For some reason this isn't working. It shows this when I listed out so I know it's setup as a cron but for some reason it's not

running. Did the code I use to set this up not structured right (the 50 * * * * ) part of it or something?  I wanted it to run 1 time per day.

Thanks again.

Link to comment
Share on other sites

The order for a crontab is: Minute, Hour, Day of Month, Month, Day of Week

So to run once a day, it should be like this:

 

0 0 * * * /kunden/usr/local/bin/php /kunden/homepages/##/#####/htdocs/email_cron.php

 

You had it to run every 50 minutes, but it's odd you didn't get emails. Have you tried running a simple cron job that just e-mails you every minute to see if cron jobs are working?

Link to comment
Share on other sites

Are you sure /kunden/usr/local/bin/php is where php is installed? Seems an odd location.

 

Also, remember that cron doesn't have much of an environment so you need to be careful to use full paths to files when your including them. We might need to see the code within your actual script.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

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

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  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.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.