Cron Job does not work with schedule but does manually.

6 posts / 0 new
Last post
#1 Mon, 04/25/2011 - 17:54
securewebs

Cron Job does not work with schedule but does manually.

The manual cron works, the schedules does not. I have read that sometimes it is an issue with the path or permissions.

Can anybody point me in the right direction? I would have thought logically that if it runs manually it would run with a schedule, but I know next to nothing about cron jobs. Please help Mr. Wizard.

This is the working manual cron.

mysqlcheck --compress --optimize -u press -database-password domain-name-here

Mon, 04/25/2011 - 18:07
andreychek

Are you receiving an error of some kind?

One thing you may want to try though is to run it using the full path, like this:

/usr/bin/mysqlcheck --compress --optimize -u press -database-password domain-name-here

Wed, 04/27/2011 - 12:39 (Reply to #2)
securewebs

Thanks andreychek:

The current job is:

/usr/bin/mysqlcheck --compress --optimize -u press -database-password mySQL_database

Unfortunately, adding the full path did not make any difference. In system logs I found the following which does not really help either.

Apr 27 08:50:50 legend crontab[32178]: (root) BEGIN EDIT (domain-name) Apr 27 08:50:51 legend crontab[32178]: (root) REPLACE (domain-name) Apr 27 08:50:51 legend crontab[32178]: (root) END EDIT (domain-name)

Would you expect there to be helpful logs about a cron failure or is there a next logical step I might do to determine what the cron job is failing?

Scott Hirsch, SecureWebs

Wed, 04/27/2011 - 13:31
andreychek

If the cron job runs, but generates an error, it should email that error to the Virtual Server owner.

You should be able to look in your logs, find the time the cron job was supposed to run, and then see if there's an entry from cron showing that it did run (or at least tried to).

What does the full cron job look like? That is, if you run this command, what output do you see:

crontab -u USERNAME -l | grep mysqlcheck

Wed, 04/27/2011 - 15:23
securewebs

Hi:

Here is the command I ran and the results:

crontab -u press -l | grep mysqlcheck

Output from command crontab -u press -l | grep mysqlcheck ..

must be privileged to use -u

Wish I was not such a newbie at this. Never really had much call to figure out the cron jobs.

Scott Hirsch

Wed, 04/27/2011 - 15:26
andreychek

That error just means you have to run the command as root when using the -u option.

-Eric

Topic locked