cron job

  • samad
  • Novice
  • Novice
  • samad
  • Posts: 15

Post 3+ Months Ago

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
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • gisele
  • Expert
  • Expert
  • User avatar
  • Posts: 585
  • Loc: Nimes (France)

Post 3+ Months Ago

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
  • samad
  • Posts: 15

Post 3+ Months Ago

i 've heard bout putty but haven't used it yet.
will try .thanks btw.
  • francis123
  • Born
  • Born
  • francis123
  • Posts: 1

Post 3+ Months Ago

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: No registered users and 77 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
 
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.