![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
Cron Jobs - why doesn't this work
Sorry for that messy post, I forgot HTML is on
![]() I wrote a simple script (source: http://www.hypergals.com/gal_update.txt ). When I run it from my browser, everything works fine and without errors, but when I order cronjobs to run it every midnight, these errors occur when executed: /home/phrona/public_html/gal_update.php: line 1: ?: No such file or directory /home/phrona/public_html/gal_update.php: line 2: syntax error near unexpected token `'gal_today.html','gal_yesterday.html'' /home/phrona/public_html/gal_update.php: line 2: ` copy('gal_today.html','gal_yesterday.html'); ?>' My hosting support done its best, but nothing helped. Absolute paths in the source didn't worked. Thanks for answer |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Join Date: Jan 2002
Location: In the walls of your house.
Posts: 3,985
|
Does the script use absolute or relative file paths?
__________________
"Every normal man must be tempted, at times, to spit on his hands, hoist the black flag, and begin slitting throats." --H.L. Mencken |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
sorry I told it wrong - the script can use both absolute and relative paths and it returns the same errors.
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Join Date: Nov 2001
Location: Poland
Posts: 219
|
how do you execute this script?
(what is your cron line) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
Confirmed User
Join Date: Mar 2003
Location: Western NY
Posts: 5,114
|
are you useing 'cron' as root or as a 'user'? and i am SURE that any cron routine must use absolute paths?
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#6 | |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
Quote:
Minutes/Hours/Days/Weeks/Months/command 0 0 * * * /home/phrona/public_html/gal_update.php |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Industry Role:
Join Date: May 2002
Location: Toronto, Canada
Posts: 5,599
|
add
#!/usr/local/bin/php as the first line of your script, unless you're excuting the script such as /usr/local/bin/php gal_update.php from your crontab. Also, the path to the php binary file may be different than your location so double check that. You'll also need to set execute permissions. chmod 755 gal_update.php |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Join Date: Nov 2001
Location: Poland
Posts: 219
|
have you tried run php scripts from shell ?
maybe you should just use lynx 0 0 * * * /usr/bin/lynx -dump http://www.mydomain.com/myscript.php > /dev/null 2>&1 just change /usr/bin/lynx to anything what 'which lynx' shows (which lynx - run this from shell) |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 | |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
Quote:
/bin/sh: /home/phrona/public_html/gal_update.php: /home/phrona/public_html/: bad interpreter: Permission denied Of course I chmoded gal_update.php. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
So Fucking Banned
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
|
edited -mistake
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 |
Registered User
Join Date: Jul 2001
Location: canada, eh?
Posts: 50
|
I ran into a similar problem with a couple of scripts. This is from the documentation of PhpAds. It seems that if you want to run a php script with cron, you have to use commands similar to these.
------------------------------------- Depending on the configuration of your server you can use one of the following tools to actually run the maintenance file: curl, fetch, lynx or wget. To find out which is supported by your server simply type the name of the tool on the command-line. If you get a message ?command not found? the tool isn?t supported on your server. # if your server supports curl: 0 * * * * curl -s -o /dev/null http://your.server.name.here/phpAdsN...aintenance.php # if your server supports fetch: 0 * * * * fetch -o /dev/null http://your.server.name.here/phpAdsN...aintenance.php # if your server supports lynx: 0 * * * * lynx > /dev/null -dump http://your.server.name.here/phpAdsN...aintenance.php # if your server supports wget: 0 * * * * wget -q -O /dev/null http://your.server.name.here/phpAdsN...aintenance.php ------------------------------------------------------ On my box, it was the wget command that did the trick. Hope this helps..... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
salad tossing sig guy
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
|
funny.. fucking with cron as well since a long time.. as we type..
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Mar 2002
Posts: 7,245
|
I had problems similar to that. This is kind of stupid how I looped it like this but that is how I got it to work
0 8 * * * /home/htdocs/domain/www/update.txt update.txt: cd /home/htdocs/domain/cgi-bin; ./script.pl;
__________________
7 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
Confirmed User
Join Date: Aug 2001
Location: In a Bunker
Posts: 868
|
Quote:
This is the easiest solution, there are others. Replace: /home/phrona/public_html/gal_update.php With: wget --spider -q http://www.hypergals.com/gal_update.php The other common solution requires the PHP binary. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 | |
Confirmed User
Join Date: Nov 2002
Posts: 7,761
|
create a file called gal_update.bat
put in it: Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 | |
Confirmed User
Join Date: Nov 2002
Posts: 7,761
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#17 | |
Confirmed User
Join Date: Aug 2001
Location: In a Bunker
Posts: 868
|
Quote:
![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |