Jump to content

Archived

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

pocobueno1388

Cron Job (Command Line) *SOLVED*

Recommended Posts

I am hosted with hostgator.com and can't figure out how to get a cron job to work. I am doing it the 'standard' say since I am not advanced at it. It is telling me to enter a "Command to run"...I have no idea what to enter in this. I have tried a couple of different things but nothing seems to work.

I think I only need the path of the file...not 'when' I want it to run. Because below where I enter the command line if gives me choices on if I want to run it every hour, day, month, etc.

I have copied and pasted an example path and replaced all the info with mine, but still couldn't get it to work. The scripts name that I am trying to run is called 'cron.php' and it is in a folder called 'public_html'.

How would I make a command line or path to that file? If I left anything out, just let me know. Thanks guys =)

Share this post


Link to post
Share on other sites
[quote]How would I make a command line or path to that file?[/quote]

This really depends on where your script is in relation to root. Something like....

[code]
php /home/username/public_html/cron.php
[/code]

may come close but really, your host should provide better docs. You may also need to put a shebang in the script to let the server know what to run the script with. eg;

[code]
#!/usr/bin/php
<?php
  // script here
?>
[/code][/code]

Share this post


Link to post
Share on other sites
Eh, it isn't really a script I need to insert into a code...the server should take care of everything if I enter the path or command line.

I tried:
php /home/username/public_html/cron.php

Nothing happened.

Share this post


Link to post
Share on other sites

×

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.