Parallels H-Sphere Forum
> Related Products > Older Products > CP+  
Idiots guide to Cron jobs  
  

Idiots guide to Cron jobs

06-18-04, 16:00
#1  

Dun
Registered User


Join: Jun 2004
Posts: 2
Idiots guide to Cron jobs
I am trying to set up a cron job to run scheduler.php from this path (edited for security):
/path/unixuser/pathto/engine/scheduler.php so what on earth do I need to put in the command and input to command boxes?
06-19-04, 02:50
#2  

hanskind
Registered User


Join: Jan 2003
Posts: 719
We run a php script from cron like this:

0 * * * * (nice -15 curl http://www.domain.com/subdir/maintenance/script.php)

This will run the script daily, at midnight.

Hope this helps

rgds

__________________
Hans Kind - The Dutchy
FlyingServers International - Europe +31 592 40 96 12
Data Centers : AMS - LHR - ATL - ORD - SLC
FlyingBackup, off-site & remote backup services
Server Security, Managed Dedicated Servers, Monitoring Service
-------------------------------------------
Wisdom is, only talk when you can improve the silence
06-19-04, 04:58
#3  

Dun
Registered User


Join: Jun 2004
Posts: 2
Quote:
Originally Posted by hanskind
We run a php script from cron like this:

0 * * * * (nice -15 curl http://www.domain.com/subdir/maintenance/script.php)

This will run the script daily, at midnight.

Hope this helps

rgds
Thanks for taking the time to try and help but no, I am still confused as to what I should put in the boxes
Appreciate your attempt at helping though
06-19-04, 05:46
#4  

hanskind
Registered User


Join: Jan 2003
Posts: 719
assuming you want this added trough the CP, into a user account cron joib, enter the follwing in the boxes:

Enter 0 in the minute field:

Enter a * in the Hour, Day of Month, Month and Day of Week fields.

Enter the following line in the Command field:

(nice -15 curl http://www.domain.com/subdir/maintenance/script.php)

rgds

__________________
Hans Kind - The Dutchy
FlyingServers International - Europe +31 592 40 96 12
Data Centers : AMS - LHR - ATL - ORD - SLC
FlyingBackup, off-site & remote backup services
Server Security, Managed Dedicated Servers, Monitoring Service
-------------------------------------------
Wisdom is, only talk when you can improve the silence
06-24-04, 14:23
#5  
profitability's Avatar

profitability
Registered User


Join: Aug 2002
Posts: 1,784
Quote:
Originally Posted by hanskind
0 * * * * (nice -15 curl http://www.domain.com/subdir/maintenance/script.php)

This will run the script daily, at midnight.
Unless I'm mistaken, I believe that will actually run the script every hour on the hour. I think the correct syntax for daily at midnight would be:

0 0 * * * (nice -15 curl http://www.domain.com/subdir/maintenance/script.php)

Andrew
07-27-06, 16:39
#6  
rodrigo's Avatar

rodrigo
Registered User


Join: Jan 2005
Posts: 258
Cron tab not running
I have followed instructions posted on this thread and still my cron tab does not run.

I have logged into the server and if I run:
(nice -15 curl http://mydomai.com/myscript.php)
from root it runs perfectly.

But if I switch to a regular user, it returns:
"Permission denied"

We did some hardening on this server according to DynamicNet's instructions, so I wonder if that is causing the cron not to run because of lack of proper permissions.

What user does the HSphere cron tab use? to check if it has proper permissions.

Also, what is the diference on using:

(nice -15 curl http://mydomai.com/myscript.php)

and using:

curl http://mydomai.com/myscript.php > /dev/null 2>&1

Thanks a lot for your help.

Rodrigo

__________________
Rodrigo Fernández
Technical Support
Edenia Systems International
"Total Internet Services in Costa Rica"
http://www.edenia.com
http://www.crservers.com
06-03-07, 23:56
#7  

dlst
Registered User


Join: Sep 2002
Posts: 168
Was there a solution found for this? I'm getting the same problem as Rodrigo. Did you end up solving the permissions problem?
06-04-07, 00:18
#8  

ladylinux
Registered User


Join: Jul 2003
Posts: 9,777
Hello,

Well in his case. I would bet that curl has permissions of 700 .. meaning it can only be executed as root. Now what are you seeing the permission issues with , what user are you running this as and what are the permissions of the binary in question. ??

Francesca

__________________
"No Problems Only Solutions"
We Provide Server Management, Security Hardening And Patch Management.
Also Dedicated Servers, Colocation, VPS Servers And Hsphere Licenses.
06-04-07, 00:24
#9  

dlst
Registered User


Join: Sep 2002
Posts: 168
I like the idea of NOT allowing curl to be executed by anyone except root.

So, in this case, what's the "correct" way of running a php file via cron from the user's hsphere cp?
06-04-07, 00:28
#10  

ladylinux
Registered User


Join: Jul 2003
Posts: 9,777
Hello,

Ok .. so you want to allow a certain subset of users to be allowed to run the php binary ???

BTW .. this is not really the right place to be talking about Hsphere stuff ..

Francesca

__________________
"No Problems Only Solutions"
We Provide Server Management, Security Hardening And Patch Management.
Also Dedicated Servers, Colocation, VPS Servers And Hsphere Licenses.
 


Thread tools Rating Display modes
Excellent
Good
Average
Bad
Terrible
Linear Mode


Parallels is a worldwide leader in virtualization and automation software that optimizes computing for consumers, businesses, and service providers across all major hardware, operating system, and virtualization platforms. Founded in 1999, Parallels is a fast-growing company with 900 employees in North America, Europe, and Asia.