Go Back   HostGator Peer Support Forums > Public Forums > Pre-Sales Questions

Notices

Reply
 
Thread Tools
  #1  
Old 02-01-2011, 10:27 AM
bzgzd bzgzd is offline
Hatchling Croc
 
Join Date: Feb 2011
Posts: 2
Default simple cron job

Hello.

I would like to create one cron job on my addon domain web site.
In CPanel there is this warning:

Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job.

But my knowledge of Linux commands is zero...

On page that I am creating (http://www.puzzleslogic.com) I need to automatically remove every day (once per day) from one mysql table all entries that have specified date older then 30 days.

Best solution for me would be if I can create cron job that will "execute" my php script.
Is this possible?
Reply With Quote
  #2  
Old 02-01-2011, 12:01 PM
rec9140 rec9140 is offline
Junior Croc
 
Join Date: Jun 2007
Posts: 137
Default Re: simple cron job

Quote:
Originally Posted by bzgzd View Post
Hello.

I would like to create one cron job on my addon domain web site.
In CPanel there is this warning:

Warning: You need to have a good knowledge of Linux commands before you can use cron jobs effectively. Check your script with your hosting administrator before adding a cron job.

But my knowledge of Linux commands is zero...

On page that I am creating (http://www.puzzleslogic.com) I need to automatically remove every day (once per day) from one mysql table all entries that have specified date older then 30 days.

Best solution for me would be if I can create cron job that will "execute" my php script.
Is this possible?
use, ALL ONE LINE! :

Code:
cd /home/<YOURUSERNAME>/public_html/YOURDIR; php -q YOURSCRIPT.php
Put this to run at what ever time you want it to.

To understand the settings:

http://www.reallylinux.com/docs/basiccron.shtml

Use the menus in CPanel to select the once/per day option and then tell it at what time to do it.

They unfortunately removed the more Unix like interface, so you will have to SSH in to use crontab -l and crontab -e to setup that way.
Reply With Quote
  #3  
Old 02-01-2011, 03:21 PM
Pitrow's Avatar
Pitrow Pitrow is offline
Swamp Croc
 
Join Date: Oct 2005
Location: Oregon
Posts: 379
Default Re: simple cron job

Quote:
Originally Posted by rec9140 View Post
They unfortunately removed the more Unix like interface, so you will have to SSH in to use crontab -l and crontab -e to setup that way.
I'm pretty sure since he said his knowledge of linux commands is zero, he's not going to have a clue what any of that sentence means.
Reply With Quote
  #4  
Old 02-01-2011, 04:04 PM
bzgzd bzgzd is offline
Hatchling Croc
 
Join Date: Feb 2011
Posts: 2
Default Re: simple cron job

Quote:
Originally Posted by rec9140 View Post
cd /home/<YOURUSERNAME>/public_html/YOURDIR; php -q YOURSCRIPT.php

They unfortunately removed the more Unix like interface, so you will have to SSH in to use crontab -l and crontab -e to setup that way.
Thx. That looks good... I think I will try it just by using "php -q </home/full path to script>.php" as my script will modify only mysql table and so I think i don't need to "cd" to script directory.

If I understand it correctly your last sentence about SSH and crontab is related to setting when to run that cron-job so for me no need to understand it as it can be set from CPanel with that web form.
Reply With Quote
Reply

Bookmarks

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 Off
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Cron Job murtuza_hasan Pre-Sales Questions 11 06-27-2009 03:50 PM
need a cron job... jWebSolution Webhosting 1 06-23-2008 11:02 PM
Cron Job osirion Suggestions 1 01-29-2008 02:39 AM
1 simple cron job question journeyoftheanimals Off-Topic 4 01-09-2008 10:12 PM
Cron Job Dwight Shared Hosting Support 7 07-27-2006 05:10 PM

All times are GMT -5. The time now is 05:20 AM.