【问题标题】:Crontab Command Separate Linecrontab 命令单独一行
【发布时间】:2013-09-10 18:33:37
【问题描述】:

我有两个 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

【问题讨论】:

    标签: linux shell cron


    【解决方案1】:

    不,你不能那样做。从手册页:

    没有办法将单个命令行拆分为多行, 就像 shell 的尾随“\”一样。

    您可以将命令放在脚本中并运行它。

    【讨论】:

      猜你喜欢
      • 2018-07-17
      • 1970-01-01
      • 1970-01-01
      • 2019-10-26
      • 2014-12-03
      • 2017-08-05
      • 1970-01-01
      • 1970-01-01
      • 2013-08-13
      相关资源
      最近更新 更多