當前位置: 首頁>>代碼示例>>Python>>正文


Python Plan.command方法代碼示例

本文整理匯總了Python中plan.Plan.command方法的典型用法代碼示例。如果您正苦於以下問題:Python Plan.command方法的具體用法?Python Plan.command怎麽用?Python Plan.command使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在plan.Plan的用法示例。


在下文中一共展示了Plan.command方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: CreatePlan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
def CreatePlan(command):
    """
    創建指定命令任務
    :param command:
    :return:
    """
    cron = Plan(command)
    cron.command('node ' + path + '/index.js ' + command, every='1.day', at='16:51')
    cron.run('write')
開發者ID:csvwolf,項目名稱:Sky_WeiboServices,代碼行數:11,代碼來源:script.py

示例2: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
# -*- coding: utf-8 -*-
"""
    demo
    ~~~~

    :copyright: (c) 2014 by Shipeng Feng.
    :license: BSD, see LICENSE for more details.
"""

from plan import Plan

cron = Plan()

cron.command('ls /tmp', every='1.day', at='12:00')
cron.command('pwd', every='2.month')
cron.command('date', every='weekend')

if __name__ == "__main__":
    cron.run()
開發者ID:2008chny,項目名稱:plan,代碼行數:21,代碼來源:schedule.py

示例3: dict

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
	jobname	='job%s-%s'%(str(j['id']),j['every'])
	logsdir	='%s/Logs/cronlogs/%s'%(os.getcwd(),jobname)

	try:
		os.makedirs(logsdir)
	except Exception,e:
		pass


	exec_command='PATH=$PATH && %s'%j['cmd']
	output      = dict(stdout='%s/%s.stdout.log'%(logsdir,jobname), stderr='%s/%s.stderr.log'%(logsdir,jobname) )

	cron = Plan(name='job'+str(j['id']))
	if j.has_key('at') :
		r=cron.command(exec_command,every=j['every'],at=j['at'],output=output,)
	else:
		r=cron.command(exec_command,every=j['every'],output=output,)

	cron.run(j['action'])
	return True

if __name__ == '__main__':
	#job1={'id':1,'cmd':'date','every':'2.day','action':'update','at':'hour.12 minute.15 minute.45'}
	job2={'id':2,'cmd':'/home/qilong/python/cron/1.sh','every':'1.hour','action':'update','at':'minute.10'}
	crontab(job2)

	#print job2
	#job2=sys.argv[1]
	#crontab(eval(job2))
開發者ID:ouchao,項目名稱:cron,代碼行數:31,代碼來源:cron.py

示例4: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
# -*- coding: utf-8 -*-

# Use this file to easily define all of your cron jobs.
#
# It's helpful to understand cron before proceeding.
# http://en.wikipedia.org/wiki/Cron
#
# Learn more: http://github.com/fengsp/plan

from plan import Plan

cron = Plan("commands")

cron.command('top', every='4.hour', output=dict(stdout='/tmp/top_stdout.log',
                                                stderr='/tmp/top_stderr.log'))
cron.command('yourcommand', every='sunday', at='hour.12 minute.0 minute.30')
# more commands here


if __name__ == "__main__":
    cron.run()
開發者ID:angrygorilla,項目名稱:plan,代碼行數:23,代碼來源:schedule_commands.py

示例5: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan
import os

cron = Plan()

crontabDir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'crontab')

hours = 'hour.19 hour.20 hour.21 hour.22 hour.23 hour.0 hour.1 hour.2 hour.3 hour.4 hour.5 hour.6 hour.7'

########################################################################
# 定時spider
name = 'cron_spider'
cron.command('flock -xn /tmp/%s.lock -c %s.sh' % (name, os.path.join(crontabDir, name)), every='1.minute')



########################################################################
# phash計算
name = 'cron_phash'
cron.command('flock -xn /tmp/%s.lock -c %s.sh' % (name, os.path.join(crontabDir, name)), every='1.day', at=hours)


########################################################################
# 匹配計算
name = 'cron_match'
cron.command('flock -xn /tmp/%s.lock -c %s.sh' % (name, os.path.join(crontabDir, name)), every='1.day',  at=hours)


########################################################################
# 匹配計算
name = 'cron_itemmatch'
開發者ID:xxoome,項目名稱:collector,代碼行數:33,代碼來源:scheduler.py

示例6: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
#
# Learn more: http://github.com/fengsp/plan

import os
from os.path import join as pjoin
from plan import Plan

dir_path = os.path.dirname(os.path.realpath(__file__))

cron = Plan(
    "scripts",
    path=pjoin(dir_path, '../scrape'),
    environment={'DJANGO_SETTINGS_MODULE': 'scrape.settings_production'}
)

# register one command, script or module
#  cron.command('command', every='1.day')
#  cron.script('script.py', path='/web/yourproject/scripts', every='1.month')
#  cron.module('calendar', every='feburary', at='day.3')

cron.command('cd %s && DJANGO_SETTINGS_MODULE=scrape.settings_production $HOME/venv/bin/scrapy crawl eoaient' % (pjoin(dir_path, '../scrape/crawler')),
    every='2.day', at='minute.48')
cron.command('cd %s && DJANGO_SETTINGS_MODULE=scrape.settings_production $HOME/venv/bin/scrapy crawl ck0tp' % (pjoin(dir_path, '../scrape/crawler')),
    every='3.day', at='minute.12')

cron.script('manage.py extoon_info', every='5.hour', at='minute.30')
cron.script('manage.py extoon_description', every='6.hour', at='minute.15')

if __name__ == "__main__":
    cron.run('update')
開發者ID:ikeikeikeike,項目名稱:scrape-django-app,代碼行數:32,代碼來源:extoon.py

示例7: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan

cron = Plan()

cron.command('python /vagrant/stackoverflow.py', every='1.day', at='12:05')
cron.command('python /vagrant/questions_monthly.py', every='1.month')
cron.command('python /vagrant/sendEmail.py', every='1.month')



if __name__ == '__main__':
    cron.run('write')
開發者ID:fanghuang,項目名稱:Predicting-Hot-Technology-Trends,代碼行數:14,代碼來源:schedule.py

示例8: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
import os
from os.path import join as pjoin
from plan import Plan

dir_path = os.path.dirname(os.path.realpath(__file__))

cron = Plan(
    "scripts",
    path=pjoin(dir_path, '../scrape'),
    environment={'DJANGO_SETTINGS_MODULE': 'scrape.settings_production'}
)

# register one command, script or module
#  cron.command('command', every='1.day')
#  cron.script('script.py', path='/web/yourproject/scripts', every='1.month')
#  cron.module('calendar', every='feburary', at='day.3')

cron.command('cd %s && $HOME/venv/bin/scrapy crawl toonchar' % (pjoin(dir_path, '../scrape/crawler')), every='1.day', at='minute.48')
cron.script('manage.py profile', every='12.hour', at='minute.24')
cron.script('manage.py actress', every='3.day', at='minute.12')
cron.script('manage.py feed', every='2.hour', at='minute.36')

cron.script('manage.py bing_image_char', every='10.day', at='minute.7')
cron.script('manage.py bing_image_toon', every='7.day', at='minute.14')
cron.script('manage.py bing_image_diva', every='4.day', at='minute.21')
cron.script('manage.py bing_image_tag', every='5.day', at='minute.28')

if __name__ == "__main__":
    cron.run('update')
開發者ID:ikeikeikeike,項目名稱:scrape-django-app,代碼行數:31,代碼來源:schedule.py

示例9: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan

cron = Plan()

cron.command('python script.py', every='1.minute')
# cron.script('script.py', every='1.day', path='/web/yourproject/scripts',
                         # environment={'YOURAPP_ENV': 'production'})

# if __name__ == "__main__":
cron.run(run_type='write')
開發者ID:ider0001,項目名稱:rahgav-new,代碼行數:12,代碼來源:cron.py

示例10: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan

cron = Plan()

cron.command('python /home/pi/motor.py -m motor4 -t 5 ', every='1.hour')
cron.command('python /home/pi/motor.py -m motor2 -t 5 ', every='1.hour')
cron.command('python /home/pi/motor.py -m motor1 -t 20 ', every='1.hour')

if __name__ == '__main__':
    cron.run('write')

開發者ID:hackolite,項目名稱:goby-openbioreactor,代碼行數:12,代碼來源:program_motor.py

示例11: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan

cron = Plan()

cron.command('python /usr/bin/motor.py -m motor4 -t 12 ', every='50.minute')
if __name__ == '__main__':
    cron.run('write')
開發者ID:hackolite,項目名稱:LeeLaOpenbioreactor,代碼行數:9,代碼來源:motor_conf.py

示例12: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
# Package Details:
# http://plan.readthedocs.org/index.html

import os
from plan import Plan

cron = Plan()

python_path = "/Users/RichardAfolabi/anaconda/envs/python3/bin/python "
job_path = os.path.join(os.getcwd(), "geo_ip_job.py")

cmd = python_path + job_path

cron.command(cmd, every='2.minute')

cron.command()

if __name__ == '__main__':
    cron.run('write')
開發者ID:RichardAfolabi,項目名稱:Data_Analysis_with_Python,代碼行數:21,代碼來源:schedule_geo_ip.py

示例13: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
from plan import Plan

cron = Plan()

cron.command('python /vagrant/stackoverflow.py', every='1.day', at='12:05')


if __name__ == '__main__':
    cron.run('write')
開發者ID:kruthar,項目名稱:Predicting-Hot-Technology-Trends,代碼行數:11,代碼來源:schedule.py

示例14: CronTab

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
#from crontab import CronTab
from plan import Plan

'''
This script uses python-crontab to run a cron job every day at noon,
to save a dump of all the keys in the Redis datastore that's used 
by notCRUD.
'''

'''
tab = CronTab(user='rudimk')
command = '/usr/bin/redis-cli bgsave'
cron_job = tab.new(cmd, comment='This command dumps Redis keys and saves them.')
cron_job.minute().on(0)
cron_job.hour().on(12)
'''

cron = Plan()
cron.command('/usr/bin/redis-cli bgsave', every='1.day', at='12:00')

if __name__ == '__main__':
	cron.run('write')
開發者ID:notcrud,項目名稱:ncbk,代碼行數:24,代碼來源:ncbk.py

示例15: Plan

# 需要導入模塊: from plan import Plan [as 別名]
# 或者: from plan.Plan import command [as 別名]
#coding:utf-8
#!usr/bin/env python
'''
@author:lucas [email protected]
@description:啟動python分析係統
@create date:2017/04/09
@see:https://pythonhosted.org/plan/
'''
from plan import Plan
'''
add:實時運行
* * * * * sleep 10;python /usr/local/pyTraff/main_temp.py
* * * * * sleep 20;python /usr/local/pyTraff/main_temp.py
* * * * * sleep 30;python /usr/local/pyTraff/main_temp.py
* * * * * sleep 40;python /usr/local/pyTraff/main_temp.py
* * * * * sleep 50;python /usr/local/pyTraff/main_temp.py

'''
cron = Plan(name='root',user='root')
    
##添加任務,按小時運行
cron.command('python /usr/local/pyTraff/main.py', every='10 * * * *')
cron.command('python /usr/local/pyTraff/originIP.py', every='12 * * * *')
cron.command('python /usr/local/pyTraff/protocol.py', every='14 * * * *')
cron.command('python /usr/local/pyTraff/user_traff.py', every='16 * * * *')
cron.command('python /usr/local/pyTraff/respIpTop.py', every='18 * * * *')
cron.command('python /usr/local/pyTraff/sessionTop.py', every='20 * * * *')
cron.command('python /usr/local/pyTraff/user_web.py', every='8 * * * *')
cron.run('update')
開發者ID:LucasEcho,項目名稱:hubu1411,代碼行數:31,代碼來源:setup.py


注:本文中的plan.Plan.command方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。