Monday, June 16, 2014

Menjalankan Cron Job di Windows



Cron

Contents

 [hide
The name Cron was originated from chronos, the greek word for time.It automates the scheduled process by executing it periodically in the background.You can set-up cron to run the tasks at scheduled timeline.

Setup Cron Job

You will have to set-up cron job manually.Following are the steps that describes cron job set-up on windows and Unix machines respectively.

Windows

Configuration

Before setting up the cron job make sure that you update the Source path of your vtiger CRM, and PHP location in vtigercron.bat file.The vtigercron.bat file can be found in vtiger CRM source location.Ex:C:\Program Files\vtigercrm-5.4.0\apache\htdocs\vtigerCRM\cron\vtigercron.bat.
    ConfigurationCRON.png
Step 1
Go to All Programs > Accessories > System Tools > Scheduled Tasks.
    Windows.png
Step 2
Click on Add Scheduled Task.
    ScheduledTasksCron.png 
Step 3
You will get a popup, click on Next button.
    CronSetup.png
Step 4
In Scheduled Task Wizard window, browse for the vtigercron.bat file in your vtiger source file.
Example:C:\Program Files\vtigercrm-5.4.0\apache\htdocs\vtigerCRM\cron\vtigercron.bat
    CronSetup2.png 
Step 5:
Rename the name of the task as per your requirement (preferably preceding with Vtiger for vtiger scheduled tasks) and set the frequency at which the task has to be called. Also set the time at which the scheduler needs to be called.
    CronTimeline.png
Step 5:
In the next step, give proper Windows user credentials.
    PCCrdentials.png
Step 6:
Once you get confirmation window, click on Finish button.
    InstallationComplete.png
The time lined tasks will be listed out under Scheduled Tasks.
    ListviewCronjob.png
Note If you have Vtiger bundled exe build installed on your server/system, all required tasks for Vtiger will already be added. Check the configuration of the Scheduled task, if it is not working properly.
Click on the task name to make changes in the scheduled task.
    EditCronSettings.png

*nix

crontab -e
This will open up a file which will have the list of configured cron jobs. Add the jobs to the list as follows: m h dom mon dow <vtigercrm-source-directory>/<path-to-the-shell-script> For e.g
  •  * * * * * sh home/vtiger/vtigerCRM5/apache/htdocs/vtigerCRM/cron/vtigercron.sh
m → minutes
h → hours
dom → day of month
mon → month
dow → day of week
Values for all these 5 fields are compulsory and should be numbers. If you do not want to specify value of any of these fields, you can use * to replace the number.
Eg: 30 * * * * → Indicates that the cron job has to be run for every 30 minutes.
<path-to-the-shell-script> -> Path to the shell script w.r.t Vtiger source directory (Eg: Path to shell script is home/vtiger/vtigerCRM5/apache/htdocs/vtigerCRM/cron/vtigercron.sh)

0 comments:

Post a Comment