用户工具

站点工具


这是本文档旧的修订版!


Cobub Razor Scheduled Task

This document is valid for Version 0.7 of Cobub Razor. Check out the release note

1 Overview

In Cobub Razor, user must setup the scheduled tasks on server so that data can automatically be processed from original database to data warehouse. All the mobile analytics reports are built from data warehouse. To automatically run the Cobub Razor scheduled task, user can setup scripts which executed by task scheduler.

The instructions below show users how to schedule task Under Linux/Unix systems, and also for Windows. There are five tasks to do scheduled for reports:

  1. runHourly – Do ETL from production database to data warehouse and generate reports for last hour.
  2. runDaily – Generate daily access path report. Must schedule at the second day.
  3. runWeekly – Generate weekly reports. Must schedule at Sunday.
  4. runMonthly – Generate monthly reports. Must schedule at the first day of a month.
  5. runLaterData – Generate data which posted from client later(later data is usually caused by Time zone or batch policy set on client).

Important Tips to Schedule the Task:

  1. archiveHourly – hourly task can be scheduled at 10 minutes of every hour.
  2. archiveUsingLog – daily task must be scheduled one time per day.
  3. archiveWeekly – the parameters of weekly task must be Sunday(the first day of last week) and Saturday(the last day of last week). It can be scheduled weekly task at 00:30 on every new week’s Sunday.
  4. archiveMonthly – the parameters of monthly task should be the first day of last month and the last day of last month. And scheduled at the first day of the new month’s midnight, such as 02:30.
  5. archiveLaterData – later data processing should be scheduled at every day. Such as 01:30

2 Scheduled tasks in Linux/Unix

The cron is time-based job scheduler in Unix-like computer operating systems. cron enables users to schedule jobs(commands or shell scripts) to run periodically at certain time or dates.

2.1 Prepare script files

Firstly, create five scripts files and put them into one folder (take /var/www/cron as example):

  1. razor_hourly_archive.sh
  2. razor_weekly_archive.sh
  3. razor_monthly_archive.sh
  4. razor_laterdata_archive.sh
  5. razor_daily_archive.sh

And please make sure the .sh file has execute rights. If no execute rights, please run

sudo chown +x *.sh

razor_hourly_archive.sh file

#!/bin/bash
php /usr/share/nginx/razor/index.php archive archiveHourly

razor_weekly_archive.sh file

#!/bin/bash
php /usr/share/nginx/razor/index.php archive archiveWeekly

razor_monthly_archive.sh file

#!/bin/bash
php /usr/share/nginx/razo/index.php archive archiveMonthly

razor_laterdata_archive.sh file

#!/bin/bash
php /usr/share/nginx/razor/index.php archive archiveLaterData

razor_daily_archive.sh file

#!/bin/bash
php /usr/share/nginx/razorindex.php archive archiveUsingLog

2.2 Crontab settings

3 Scheduled tasks in Windows

3.1 Create scheduled tasks

3.2 scheduled tasks settings

4 Web Cron

5 Next Step – Configuration

en/razor/auto-archiving.1426646273.txt.gz · 最后更改: 2017/07/14 11:12 (外部编辑)