I'm not in front of a testing environment right now but I desire to download a Bash script with curl and then load its content into crontab.

The content as appears in Github raw document is for example:

0 0 * * * ... 
0 0 * * 0 ...

Is this code template looks okay to you?

curl -O https://raw.githubusercontent.com/user/repo/master/file.sh | crontab
  • You said curl by default outputs to stdout. I think I understand you: The pipe works on stdin therefor it will fail, right? – Arcticooling Jan 12 '18 at 18:08

curl outputs to stdout by default so

curl URL

is enough. And at least on macOS crontab needs a - to read from stdin so we end up with

curl URL | crontab -

Whether it is wise to load unverified data from an URL directly into Cron is another question though...

  • Thanks, the data is verified from my personal Github account. – Arcticooling Jan 12 '18 at 18:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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