Schedule Your Script using Cron Job | Lessoncup Programming Blog

Sunday, 3 April 2016

Schedule Your Script using Cron Job

LOT'S of Programmers like PHP even i am also, because it is easy to write code and develop small to large web applications, Today i am going to tell you about What is CRON JOB ? even i am not even know about this, The Reason to use CronJob is simple i will give an example if you send an email to your visitors at particular time in daily,


you no need to open gmail or other stuff and send each one about your article just go for CronJob, Earlier back i was working in company and i got a client requirement like the client need the login and logout details of all employers to his Email in every day at morning 10 am and evening 7 pm so i thought is it possible to write the script using php, i just thinking and got some thought just i need to write the schedule script or run the php file at the decided times, and i heard about Cron job

The Cron Job is a default service provided by hosting providers and it is available in your CPANEL if you not find you can request to your hosting provider to enable the feature, the cron job is available in UNIX and LINUX servers, the cron job works as per your given schedule time the php file or command will execute, if you familiar with LINUX Commands you can write the command also

The Cron Job work with few options
  • Common Settings ( here you can select how many times your script will run)
  • Minute
  • Hour
  • Day
  • Month
  • Week Day
  • Command ( here you can give the file path name hosted in your server )

The bellow image is showing the icon of Cron Jobs in your cpanel click on icon

The next image is showing the Cron Jobs Options form here you can select the timing at which time your file to be run you can select by Minutes , Hours , Day , Month , Weekday , and Command in the command line give the file path and click on Add New Cron Job button, later you can also edit and delete the created Cron Job

Ex: /home/username/public_html/filename.php


Hope This will help you.

2 comments :

  1. Nice post.
    WebCron is a great method of automating tasks on your server if you’re not blessed with cron jobs, you can be found a list of free webcron services at: http://www.cronjobservices.com.

    ReplyDelete

Mohammad Khasim
Blogger | Web Developer
Hyderabad - INDIA
lessoncup@gmail.com

PHP | My SQL | JQUERY
Web Development Tools | CMS | Frameworks | SEO

Get my Latest Lessons