- Messages
- 562
- Reaction score
- 1
- Points
- 18
Well, first off, I did use the search function and everything, Google lots of stuff, try different methods... but I can't get my cron job to work, although I am sure it's a pretty basic thing I'm trying to do.
Goal: Having a cron job that will update a particular table of my database everyday at midnight.
Query: mysql_query("UPDATE users SET actions='10'");
Pretty simple indeed... But from what I have read, I need to set my cron job to launch a script from a .php file containing my query, which I tried to do, but I got error messages such as "cannot execute binary file" and now "/home/salvatos/public_html/cgi-bin/daily_script.php: line 1: ?: No such file or directory
/home/salvatos/public_html/cgi-bin/daily_script.php: line 2: syntax error near unexpected token `('"
Here's the script I wanted to use:
Maybe there's something wrong with it, or with my cron command:
The file's permissions have been set to 755, I don't know if they should be different.
Ideally, I'd like a full example of how to set up the whole thing. You have here the directories, command and php code, so you should be able to point me everything I guess. I'm willing to throw in a few credits if necessary.
Thanks in advance.
Goal: Having a cron job that will update a particular table of my database everyday at midnight.
Query: mysql_query("UPDATE users SET actions='10'");
Pretty simple indeed... But from what I have read, I need to set my cron job to launch a script from a .php file containing my query, which I tried to do, but I got error messages such as "cannot execute binary file" and now "/home/salvatos/public_html/cgi-bin/daily_script.php: line 1: ?: No such file or directory
/home/salvatos/public_html/cgi-bin/daily_script.php: line 2: syntax error near unexpected token `('"
Here's the script I wanted to use:
Code:
<?
$connexion = mysql_connect("localhost","user","password");
if ( ! $connexion )
die ("connexion impossible");
$link="salvatos_rpg";
mysql_select_db($link) or die ("pas de connexion");
mysql_query("UPDATE users SET actions='10'");
?>
Maybe there's something wrong with it, or with my cron command:
Code:
/home/salvatos/public_html/cgi-bin/daily_script.php
The file's permissions have been set to 755, I don't know if they should be different.
Ideally, I'd like a full example of how to set up the whole thing. You have here the directories, command and php code, so you should be able to point me everything I guess. I'm willing to throw in a few credits if necessary.
Thanks in advance.