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.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 01-23-2004, 08:25 AM   #1
Phrona
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 IM posting that again:

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
Phrona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:32 AM   #2
NetRodent
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
NetRodent is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:36 AM   #3
Phrona
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.
Phrona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:39 AM   #4
Anothers
Confirmed User
 
Join Date: Nov 2001
Location: Poland
Posts: 219
how do you execute this script?

(what is your cron line)
Anothers is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:41 AM   #5
WebTitan
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?
WebTitan is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:47 AM   #6
Phrona
So Fucking Banned
 
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
Quote:
Originally posted by Anothers
how do you execute this script?

(what is your cron line)
I have currently 3 cronjobs placed and 2 (cgi) of them work, this (php) doesnt, so I don't expect the error to be here. I don't type whole row, there is user friendly control panel:

Minutes/Hours/Days/Weeks/Months/command

0 0 * * * /home/phrona/public_html/gal_update.php
Phrona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:49 AM   #7
notjoe
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
notjoe is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 08:52 AM   #8
Anothers
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)
Anothers is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 09:06 AM   #9
Phrona
So Fucking Banned
 
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
Quote:
Originally posted by notjoe
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
I did what you said and I received this error:

/bin/sh: /home/phrona/public_html/gal_update.php: /home/phrona/public_html/: bad interpreter: Permission denied

Of course I chmoded gal_update.php.
Phrona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-23-2004, 09:07 AM   #10
Phrona
So Fucking Banned
 
Join Date: Nov 2003
Location: Czech Republic
Posts: 96
edited -mistake

Last edited by Phrona; 01-23-2004 at 09:10 AM..
Phrona is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2004, 11:51 PM   #11
Scuzz
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.....
Scuzz is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-24-2004, 11:58 PM   #12
mrthumbs
salad tossing sig guy
 
mrthumbs's Avatar
 
Join Date: Apr 2002
Location: mrthumbs*gmail.com
Posts: 11,702
funny.. fucking with cron as well since a long time.. as we type..
mrthumbs is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2004, 12:10 AM   #13
kenny
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
kenny is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2004, 12:18 AM   #14
RK
Confirmed User
 
Join Date: Aug 2001
Location: In a Bunker
Posts: 868
Quote:
Originally posted by Phrona
My hosting support done its best, but nothing helped. Absolute paths in the source didn't worked.
That is just sad; this is a very obvious issue.
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.
RK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2004, 12:20 AM   #15
goBigtime
Confirmed User
 
Join Date: Nov 2002
Posts: 7,761
create a file called gal_update.bat

put in it:

Quote:
#!/bin/sh

cd /home/phrona/public_html

/usr/local/bin/php /home/phrona/public_html/gal_update.php
then chmod 755 gal_update.bat and call it from your cron job.
goBigtime is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2004, 12:26 AM   #16
goBigtime
Confirmed User
 
Join Date: Nov 2002
Posts: 7,761
Quote:
Originally posted by Scuzz - edited by gobigtime


# If you run linux or freebsd your server should have wget
0 * * * * wget -q -O /dev/null http://www.yourdomain.com/gal_update.php
If you use a solution like the one above, then be sure to limit access to that script so that only the boxes local IP can acccess it.
goBigtime is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 01-25-2004, 12:56 AM   #17
RK
Confirmed User
 
Join Date: Aug 2001
Location: In a Bunker
Posts: 868
Quote:
Originally posted by goBigtime


If you use a solution like the one above, then be sure to limit access to that script so that only the boxes local IP can acccess it.
Or do it the easy way and just don't tell anyone the URL
RK is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.