Skip to content

Instantly share code, notes, and snippets.

@matasaru
Last active May 12, 2016 22:43
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save matasaru/11e64d5907be62e765908cf5368b8222 to your computer and use it in GitHub Desktop.
Save matasaru/11e64d5907be62e765908cf5368b8222 to your computer and use it in GitHub Desktop.
reschedule te.com tasks weekly to avoid drifting
-- add line below to crontab - will update task_scheduler.next_check 10 minutes before first task is supposed to run
-- 50 23 * * 5 psql linktiger -f tasks/te-com.sql > tasks/te-com.log 2>&1
update task_scheduler set next_check= current_date - cast(extract(dow from current_date) as int) + 6 + time '00:00:00.000000' where task_id = 85339; -- url = 'http://www.te.com/jpn-ja/home.html';
update task_scheduler set next_check= current_date - cast(extract(dow from current_date) as int) + 6 + time '10:00:00.000000' where task_id = 85338; -- url = 'http://www.te.com.cn/chn-zh/home.html'
update task_scheduler set next_check= current_date - cast(extract(dow from current_date) as int) + 6 + time '20:00:00.000000' where task_id = 85340; -- url = 'http://www.te.com/deu-de/home.html';
update task_scheduler set next_check= current_date - cast(extract(dow from current_date) as int) + 7 + time '06:00:00.000000' where task_id = 85341; -- url = 'http://www.te.com/global-en/home.html';
update task_scheduler set next_check= current_date - cast(extract(dow from current_date) as int) + 7 + time '16:00:00.000000' where task_id = 85337; -- url = 'http://www.te.com/usa-en/home.html'
select ts.task_id, tu.url, ts.next_check
from task_url tu
join task_scheduler ts ON ts.task_id = tu.task_id
where customer_id=63048
order by next_check;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment