What is Cron job?
"Cron" is a system daemon used to execute desired tasks (in the background) at designated time intervals.
Why Setup Cron Job?
FlinkISO™ uses cron jobs for generating reports automatically. Reports generated on a daily, weekly and monthly basis. You need to first set up the cron job for shell command.
How to use cron job?
Cron is driven by a crontab (cron table) file, a configuration file that specifies shell commands to run periodically on a given schedule. The crontab files are stored where the lists of jobs and other instructions to the cron daemon are kept. Users can have their own individual crontab files and often there is a system wide crontab file (usually in /etc or a subdirectory of /etc) that only system administrators can edit.
Use the following commands to set a cron to run auto-generate reports:
- To generate daily report you need to set up cron tab by using following command:
50 23 * * * cd /full/path/to/app && Console/cake report
(Will run DailyReportShell at 11:50 pm on every day.)
- To generate brach and department graph you need to set up cron tab by using following command:
0 1 * * * cd /full/path/to/app && Console/cake graph
(Will run GraphShell at 1:00 am on every day.)
- To generate Weekly report you need to set up cron tab by using following command:
0 1 * * 1 cd /full/path/to/app && Console/cake weekly_report
(Will run WeeklyReportShell at 1:00am on every Monday.)
- To generate monthly report you need to set up cron tab by using following command:
0 1 1 * * cd /full/path/to/app && Console/cake monthly_report
(Will run MonthlyReportShell Report at 1:00am on the first day of the month)
More about Cron Commands:
crontab -e:
This command edit your crontab file if exist. if file doesn't already exist it will create new one and allow you to write cron job.
crontab -l:
This command display your crontab file.
crontab -r:
This command remove your crontab file.
crontab -v:
This command display the last time you edited your crontab file.
You can see more information here : http://book.cakephp.org/2.0/en/console-and-shells/cron-jobs.html