我可以看到这是“常见”错误,但在我的情况下找不到解决方案...
使用以下命令运行Crontab作业:
expr `date +%W` % 2 > /dev/null && curl https://mysite.com/myscript
它会导致错误:
/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file
你能帮我如何避免它们吗?提前非常感谢您!
最佳答案
您必须转义%
字符。 man 5 crontab
说:
Percent-signs (%) in the command, unless escaped with backslash (\),
will be changed into newline characters, and all data after the first %
will be sent to the command as standard input.
关于cron - 运行cron作业会在寻找匹配的 ``'时产生意外的EOF错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11168544/