-   Programming (
-   -   Daily Cron jobs with a PHP file (

Gargomel7 09-12-2003 10:24 AM

Daily Cron jobs with a PHP file
I have a php file that scans a MySQL DB for expired articles and will change the necessary entries. The file works great when run manually. I'm just wondering how to run this file in an automatic daily cron?

I saw one post showing a lynx dump, but I have no clue how to even start with setting one up. I'm fairly new to linux, but not to computers. If anyone could help that'd be great.

Thank you.

Andy@DP 09-12-2003 10:28 AM

cron tab would look like this:
0 0 * * * /usr/bin/lynx --dump http://your_php_script> /dev/null

that would run the script daily at midnight.
Take a look at for more about php and cron.

Hope this helps

Gargomel7 09-12-2003 10:33 AM

do i need the > after the link?

Gargomel7 09-12-2003 10:34 AM

i've read some stuff about setting the file as i need to do that as well?

Andy@DP 09-12-2003 10:40 AM

yes using chmod to set it world executable i think. The > redirects the output to the DEV/NULL. Dunno what that does but I was told to do it that way by someone when installing some file that ran every 10 minutes

Gargomel7 09-12-2003 10:45 AM

so chmod 700 and then add the > to the end of the url?
i put this in the cron.daily folder....should i add it to crontab? or is it fine by itself in the cron.daily folder?

Gargomel7 09-13-2003 03:52 PM

I'm trying to run two separate cron jobs.

The first one runs a php script that is supposed to update a mysql database. The script works fine when its run manually, but i wanted it to run as a cron.
i set the file to executable chmod 700, here's the line i put in the file.
0 0 * * * /usr/bin/lynx --dump http://ip/knowledge_base/athena/cust..._pnp_check.php> /dev/null/

i checked my root mail for today and got this message:
/etc/cron.daily/expired_pnp: line 1: /dev/null/ is a directory

my other cron job i'm trying to set up is a mysql dump.
again i set hte file to executable and here is what is in the file:

mysqldump -uusername -ppassword --databases knowledge_db -c -e > /mnt/backups/`date +%m%d%y`.knowledge_db.sql
mysqldump -uusername -ppassword --databases knowledge_db -c -e | sendmail
it couldn't send th email for some reason regarding the sendmail setup, but i got an error in my mail showing:
/etc/cron.dialy/knowledge_db_dump: line 3: /mnt/backups/091303.knowledge_db.sql: No such file or directory.

Any help would be greatly appreciated. I'm kinda pulling out my hair at this point.

Thanks in advance.

Gargomel7 09-13-2003 08:21 PM

thanks to the jerk that logged in and changed the pw. =o)

All times are GMT -5. The time now is 11:47 PM.