当前位置: 首页>>代码示例>>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;未经允许,请勿转载。