利用cmd实现组网产品任务

本文介绍了一种使用Python进行定时任务处理的方法,并通过调用外部exe文件实现雷达数据处理自动化。具体包括如何创建子进程来运行多个不同时间戳的数据处理任务。

#coding=utf-8
import os,logging,ctypes,pdb
import subprocess
import time
from datetime import datetime
from datetime import timedelta
aMinute=timedelta(minutes=-5)
Now = datetime.now()
a = Now + aMinute
b=a +aMinute
# print 'Now=', Now.strftime('%Y%m%d%H%M')
# print 'a=',a.strftime('%Y%m%d%H%M')
# print 'b=',b.strftime('%Y%m%d%H%M')
# cmd = r"RadaS.exe -o=E:\radar_operation\test_bed\output\S3 -i="+radarfile+" /uc"
# try:
#     os.chdir(r"E:\radar_operation\exe\LongJiang")
#     p = subprocess.Popen(cmd,shell=True)#,stdout=subprocess.PIPE)
# except:
#     print 'error->run command ',cmd ,' failed!'

cmd0 = r"RadaM.exe -o=E:\radarexe\output\N3 -i=E:\radarexe\output\S3 -t=%s  /uc"%Now.strftime('%Y%m%d%H%M')
cmd1 = r"RadaM.exe -o=E:\radarexe\output\N3 -i=E:\radarexe\output\S3 -t=%s  /uc"%a.strftime('%Y%m%d%H%M')
cmd2 = r"RadaM.exe -o=E:\radarexe\output\N3 -i=E:\radarexe\output\S3 -t=%s  /uc"%b.strftime('%Y%m%d%H%M')
print 'cmd0=', cmd0
print 'cmd1=', cmd1
print 'cmd2=', cmd2
try:
    os.chdir(r"E:\radarexe")
    p0 = subprocess.Popen(cmd0,shell=True)#,stdout=subprocess.PIPE)
    p1 = subprocess.Popen(cmd1,shell=True)
    p2= subprocess.Popen(cmd2,shell=True)
except:
    print 'error->run command ',cmd ,' failed!'

 

转载于:https://www.cnblogs.com/xiaoxiaoshuaishuai0219/p/6400308.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值