US: 1-941-4621-069
  
Cyprus: 3-572-2052-781

Go Back   ISPsystem.com Forums > ISPmanager > Troubleshooting


Reply
 
Thread Tools
Old 02-16-2012, 12:02 PM   #1
Junior Member
 
Join Date: Jan 2012
Location: Copenhagen, Denmark
Posts: 12
jimpannell is on a distinguished road
Default Problem with executing php scripts via Scheduler (cron)

Hi there

I've been having problems running php scripts via the scheduler that would normally be run via a url in the browser (for example, www.mydomain.com/script.php).

One particular script runs a mysql backup utility script. When I run it directly from the browser it works without issue, but when I run it via cron I get nothing.

I've tried the following with no success:

/usr/bin/wget -O -q http://www.mydomain.script.php
/usr/bin/php -q /path/to/script/
wget -q http://www.mydomain.script.php

My system is running Debian 6.

Any help would be greatly appreciated.

Cheers


Jim
jimpannell is offline   Reply With Quote
Old 02-16-2012, 06:59 PM   #2
ISPsystem team
 
slava's Avatar
 
Join Date: May 2008
Location: ISPsystem
Posts: 588
slava is on a distinguished road
Default

What you see in cron logs? /var/log/cron ?
slava is offline   Reply With Quote
Old 02-17-2012, 11:49 AM   #3
Junior Member
 
Join Date: Jan 2012
Location: Copenhagen, Denmark
Posts: 12
jimpannell is on a distinguished road
Default

I'm seeing stuff like:
Feb 16 03:46:01 li273-156 /USR/SBIN/CRON[27108]: (root) CMD (curl -O http://domain.com/?ACT=14&auth=BM36F76Z)

But I'm not getting the same result as I get from running the script in the browser.

What's the official way to run a php script that could also be run in the browser? curl? wget?
jimpannell is offline   Reply With Quote
Old 02-17-2012, 03:37 PM   #4
ISPsystem team
 
slava's Avatar
 
Join Date: May 2008
Location: ISPsystem
Posts: 588
slava is on a distinguished road
Default

Try run in ssh
Code:
/usr/bin/wget -O - 'http://domain.com/?ACT=14&auth=BM36F76Z'
and are you have any result?
If it work try add this commant to Cron
slava is offline   Reply With Quote
Old 02-17-2012, 04:49 PM   #5
Junior Member
 
Join Date: Jan 2012
Location: Copenhagen, Denmark
Posts: 12
jimpannell is on a distinguished road
Default

That completely worked! Many thanks Slava.
jimpannell is offline   Reply With Quote
Reply

Tags
cron

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 01:17 PM.