我有两个python脚本:
#1. getUrl.py # used to collect target urls which takes about 10 mins and used as the input for the next script
#2. monitoring.py # used to monitoring the website.
00 01 * * * /usr/bin/python /ephemeral/monitoring/getUrl.py > /ephemeral/monitoring/input && /usr/bin/python /ephemeral/monitoring/monitoring.py >> /ephemeral/monitoring/output
我把这个命令放在crontab中,想知道我怎么能把那个长命令写成两三行。类似下面的python行分隔符示例,但对于Crontab命令,所以它更具可读性:
>>> print \
... 'hel\
... llo'
helllo
答案 0 :(得分:35)
不,你不能这样做。从手册页:
无法将单个命令行拆分为多行, 就像shell的尾随“\”。
您可以将命令放在脚本中并运行它。