我想在centos7中安排一个cron作业,每天在需要在控制台上输出的给定时间运行“.py”脚本。该脚本需要用户输入4个
import sys
import os
from stat import S_IMODE, S_ISDIR, S_ISREG
import pysftp
from glob import glob
import datetime
import shutil
import git
from itertools import izip_longest
import filecmp
import getpass
def main():
prod_path = raw_input("Enter the ABSOLUTE PATH where you wish to download Prod files and folders: ")
git_path= raw_input("Enter the ABSOLUTE PATH where you wish to download GIT files and folders: ")
known_hosts_path=raw_input("Enter the ABSOLUTE PATH of the known_hosts file:")
p=getpass.getpass("Enter the Password for Production server:")
因为它应该在Windows中安排,所以我使用了以下
if __name__== "__main__":
main()
raw_input("\n Press enter to quit")
防止在Windows中自动退出
如何编辑crontab以适应这些?
注意:
哪个python返回我
/usr/bin/python
我尝试了以下内容:
12 15 * * * /usr/bin/python /root/prodgit.py -prod_path /root/prod -git-path /root/git -known_hosts_path /root/known_hosts.txt -p xxxx