cron job

  • samad
  • Novice
  • Novice
  • No Avatar
  • Joined: Mar 30, 2006
  • Posts: 15
  • Status: Offline

Post March 30th, 2006, 9:28 am

ok,this is my first post.

I have designed a php file that when run,emails all the subscribers about the latest site updates.I require this script to run every 12 hrs interval.The php file digs up the subsscribers' email from the db and messages the latest headlines to their email.i can manully run this script by just pointing my browser to the script location like "www.mysite.com/secret_directory/msg_script.php" every time i wanna send e-mails to the subscribers.I cannot afford to miss a single email alert.But unfortunately,sometimes i do--which is bad.

I wanted to know a way to use crontab in cpanel/plesk to run this script every 12hrs interval.I am a novice so some detailed info would be useful.
  • Anonymous
  • Bot
  • No Avatar
  • Joined: 25 Feb 2008
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post March 30th, 2006, 9:28 am

  • gisele
  • Expert
  • Expert
  • User avatar
  • Joined: Nov 11, 2004
  • Posts: 583
  • Loc: Nimes (France)
  • Status: Offline

Post March 30th, 2006, 10:48 am

Hi,
First in a local schell, or in a remote SSH connection (for example with putty) :
open the crontab file in edition mode :
Code: [ Select ]
crontab -e

and you create this line (every 12h) :
Code: [ Select ]
0 */12 * * path_to_your_script/your_script.php >> path_to_log_file

if you don't want to set a log file, just put ">>/dev/null" at the end.

or you can also say every days, 0h00, and 12h00:
Code: [ Select ]
0 0,12 * * path_to_your_script/your_script.php >> path_to_log_file
  • samad
  • Novice
  • Novice
  • No Avatar
  • Joined: Mar 30, 2006
  • Posts: 15
  • Status: Offline

Post March 30th, 2006, 10:55 am

i 've heard bout putty but haven't used it yet.
will try .thanks btw.
  • francis123
  • Born
  • Born
  • No Avatar
  • Joined: Sep 05, 2009
  • Posts: 1
  • Status: Offline

Post September 7th, 2009, 8:13 am

I have 2 pages writing in php, and i want a cron job to run the first page 'every hour' and the second page every '24hours in other words mid night' please can you help me? this have been killing me for the past weeks, and am a Newbie to cron job. am using cPanel

I tried this.

0 * * * * /home/axe/public_html/admin/viewmemstat.php 1>/dev/null 2>&1

for every hour, using the 'standard area' and this is the mail sent to me

"mycron.txt":1: bad minute
errors in crontab file, can't install.


please help!!!

Post Information

  • Total Posts in this topic: 4 posts
  • Users browsing this forum: Kurthead+1 and 170 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 2011 Unmelted, LLC. Ozzu® is a registered trademark of Unmelted, LLC.