cronjob excution problem

Vadee

Verified User
Joined
Sep 19, 2004
Messages
5
I have a created a cronjob and want to execute this. The mail function within the script workes perfect (through the cronjob) but I also want to create a html file or import the data into MYsql database.

If I go directly to the .php script file it will execute the functions perfect however the cronjob doesn't excute the html or mysql functions.

I use the command:

/usr/local/bin/php -q -f /home/<user>/domains/<domainname>/public_html/script.php

Do I have to use another command ?

Greetz Vadee
 
Does that eact command work from the command line?
Are other cronjobs running fine?

You might want to check the permissions of the file, making sure it belongs to the right user/group and is chmod'd appropriately to be executed by cron.
 
My command works from the command line and only the cronjob with a mailfunction works fine the other cronjobs don't execute.

I did chmod'd the file to 755 & 777 also tried to execute when I put this on top of my file #!/usr/local/bin/php but nothing seems to works.

How and where can I check that the permission is set to the right user / group ?
 
first I login as the root then I go to the user and login as that user.
 
Vadee said:
first I login as the root then I go to the user and login as that user.

So you're doing it via DA and not the command line, right? (I always do crons as the user from the command line with 'crontab -e')

I think the issue is that php is not coming into play since that's assigned to root or apache or one of those users.

Chances are your wget is not locked down. Try doing a cron like this:

/usr/bin/wget --quiet -O /dev/null http://(domainname)/script.php

What is the script for? I'm curious now. :)

-drmike
 
I did tried your suggestion, still nothing happens.

And I do it from the DA control panel (as client), below the advanced Features I choose the option Cronjobs and there fill in the Command textarea.

I will (try) use this script to send a newsletter email and create a html file of it, and update the database with the last of the last (succesfully) send newsletter for each client. Also use a similar script to backup my database.

grz Vadee
 
Last edited:
Screw it. I hate doing crons as root but....

I'm hoping you can SSH into your box, right?

Please kindly do so and 'su -' up to root.

Do a 'crontab -e' from the command line.

when it brings up the file in a text editor (I'm assuming vi), press the 'i' key for insert and add your line above in a blank line. Not the one I gave you but the one in your original post. When done, press the 'Esc' key followed by ':wq' without the quotes. It'll save the file and exit vi. It should also give you a message saying that it's updating the cron. You can do a 'crontab -l' to see all your commands from the prompt.

Try that. Again I hate doing crons from root but it should work that way.

-drmike
 
I have no Idea I'm a newby on the subject SSH and cronjobs
where can I find all of this ? :confused:
 
Back
Top