Beispiel #1
0
def update():
    mt = MongoDBTaskClient()
    tasks_list = mt.get_need_update_task()
    while True:
        time.sleep(2)
        if tasks_list:
            for t in tasks_list:
                if t['status'] == '3':
                    app_name = t['app_name']
                    p = subprocess.Popen('scrapy crawl channels -a apk_name=%s --logfile=log/%s.log'%(app_name, app_name), shell=True)
Beispiel #2
0
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from get_task import MongoDBTaskClient
import time

if __name__ == '__main__':
    mt = MongoDBTaskClient()
    # mt.collect_drop()
    mt.insert_task(u'广东华兴银行')
    # # time.sleep(60)
    mt.insert_task(u'招商银行')
    # time.sleep(60)
    # mt.insert_task(u'民生银行')
    # # time.sleep(60)
    # mt.insert_task(u'微信')
    # mt.insert_task(u'微信锁')
    # mt.insert_task(u'微信电话本')
Beispiel #3
0
# def update():
#     mt = MongoDBTaskClient()
#     tasks_list = mt.get_need_update_task()
#     while True:
#         time.sleep(2)
#         if tasks_list:
#             for t in tasks_list:
#                 if t['status'] == '3':
#                     app_name = t['app_name']
#                     p = subprocess.Popen('scrapy crawl channels -a apk_name=%s --logfile=log/%s.log'%(app_name, app_name), shell=True)
#

if __name__ == '__main__':
    # p = Process(target=update)
    # p.start()
    # p.join()

    mt = MongoDBTaskClient()
    tasks_list = mt.get_need_update_task()
    # print tasks_list,'--------------'

    if tasks_list:
        for t in tasks_list:
            app_name = t['app_name']
            p = subprocess.Popen('scrapy crawl channels -a apk_name=%s --logfile=log/%s.log'%(app_name, app_name), shell=True)

    now = datetime.datetime.now().strftime('%Y-%m-%d %H:%M:%S %f')
    with open('test_crontab.log', 'a') as f:
        f.write(now + '\n')
Beispiel #4
0

def update():
    mt = MongoDBTaskClient()
    tasks_list = mt.get_need_update_task()
    while True:
        time.sleep(2)
        if tasks_list:
            for t in tasks_list:
                if t['status'] == '3':
                    app_name = t['app_name']
                    p = subprocess.Popen('scrapy crawl channels -a apk_name=%s --logfile=log/%s.log'%(app_name, app_name), shell=True)


if __name__ == '__main__':
    # p = Process(target=update)
    # p.start()
    # p.join()

    mt = MongoDBTaskClient()
    tasks_list = mt.get_need_update_task()
    print tasks_list,'--------------'

    if tasks_list:
        for t in tasks_list:
            app_name = t['app_name']
            p = subprocess.Popen('scrapy crawl channels -a apk_name=%s --logfile=log/%s.log'%(app_name, app_name), shell=True)



Beispiel #5
0
#!/usr/local/bin/python
# -*- coding: utf-8 -*-
from get_task import MongoDBTaskClient
import time

if __name__ == '__main__':
    mt = MongoDBTaskClient()
    # mt.collect_drop()
    mt.insert_task(u'广东华兴银行')
    # # time.sleep(60)
    # mt.insert_task(u'招商银行')
    # time.sleep(60)
    mt.insert_task(u'民生银行')
    # # time.sleep(60)
    # mt.insert_task(u'微信')
    # mt.insert_task(u'微信锁')
    # mt.insert_task(u'微信电话本')