Created
December 13, 2016 06:36
-
-
Save ponggung/76d12120753e49f6efceb22d1e23c732 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
# @Author: WPK | |
# @Date: 2016-09-12 14:43:07 | |
# @Last Modified by: WPK | |
# @Last Modified time: 2016-09-30 11:46:22 | |
# -*- coding: utf-8 -*- | |
""" | |
Created on Fri Jul 22 12:43:00 2016 | |
@author: wpk | |
""" | |
# Run this cron in Linux system | |
import schedule | |
import time | |
import os | |
py = "/home/alpha/anaconda3/bin/python " | |
workpath = os.getcwd() | |
log = " &> " + os.getcwd() + "log" | |
def test(): | |
print("I'm working") | |
def eq(): | |
# print("cwb eq. ...") | |
cmd = py + workpath + "/data_cwb_eq.py" + log | |
os.system(cmd) | |
def rain(): | |
# print("cwb rain.....") | |
cmd = py + workpath + "/data_cwb_rain.py" + log | |
os.system(cmd) | |
def db_rain(): | |
# print("db_rain....") | |
cmd = py + workpath + "/db2html_rain.py" + log | |
os.system(cmd) | |
def typhoon(): | |
# print("db_rain....") | |
cmd = py + workpath + "/data_cwb_typhoon.py" + log | |
os.system(cmd) | |
# sample | |
# schedule.every(1).minutes.do(job) | |
# schedule.every(1).hour.do(job) | |
# schedule.every().day.at("12:49").do(job) | |
schedule.every(1).hour.do(rain) | |
schedule.every(1).hour.do(eq) | |
schedule.every(1).hour.do(db_rain) | |
schedule.every(1).hour.do(typhoon) | |
while 1: | |
schedule.run_pending() | |
time.sleep(1) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment