55

I have two python scripts:

#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

I put the this command in crontab and wondering how could I write that long command into two or three lines. Something like the python line separator example below but for Crontab command, so it is more readable:

>>> print \
... 'hel\
... llo'
helllo

1 Answer 1

93

No, you can't do that. From the man page:

There is no way to split a single command line onto multiple lines, like the shell's trailing "\".

You can put the commands in a script and run it.

1
  • Specifically, this information is found in man 5 crontab.
    – daviewales
    Commented Mar 4 at 22:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.