Jump to content

[SOLVED] cronjob


blankextacy

Recommended Posts

ok im using cron tab 5 i guess well when ever i try to run a command it works fine but it doesnt run the file instead i get this error.

/home/mitchell/public_html/cron_min/cron_minute.php: line 1: syntax error near unexpected token `('
/home/mitchell/public_html/cron_min/cron_minute.php: line 1: `<? include("config.php");'

and when i used to use free cronjob services it ran the files perfectly

 

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/
Share on other sites

ya there it is im getting this error now

/home/mitchell/public_html/cron_min/cron_minute.php: line 1: ?: No such file or directory
/home/mitchell/public_html/cron_min/cron_minute.php: line 2: syntax error near unexpected token `"update turn set time_right=time_right-1"'
/home/mitchell/public_html/cron_min/cron_minute.php: line 2: `mysql_query("update turn set time_right=time_right-1");'

<? include "config.php";
mysql_query("update turn set time_right=time_right-1");
mysql_query("update turn set time_right=9 where time_right = -1");
mysql_query("update turn set time_left=6 where time_right = 0 and time_left = 0");
mysql_query("update turn set time_left=time_left-1 where time_right = 9");

$spell1 = mysql_query("select * from spellc");
while ($spell = mysql_fetch_array($spell1)) {
mysql_query("update spellc set time=time-1 where id=$spell[id]");

mysql_query("DELETE from spellc where id=$spell[id] and time<=1");

}
?>

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182452
Share on other sites

For starters, if your trying to run php from the command line it needs a shebang line. eg;

 

#!/usr/bin/php

 

Otherwise bash won't know which program should execute the script. Second, are you sure you have short tags enabled? Use <?php instead of <?. Thirdly, that is some horrible code. There is absolutely no error handling... ever heard of an if() statement? Your code assumes that every query is successful.

Link to comment
https://forums.phpfreaks.com/topic/38107-solved-cronjob/#findComment-182454
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.