简体   繁体   English

cron 命令在共享主机中无法与 DirectAdmin 一起使用

[英]cron command not working with DirectAdmin in shared hosting

I have the below cron command which is working perfectly with CPanel, but not working in the DirectAdmin panel.我有以下 cron 命令,它可以与 CPanel 完美配合,但不能在 DirectAdmin 面板中工作。 This command downloads a zip file every minute having the current date as a name (ex. 2021-03-09.zip) from the remote URL to the local directory.此命令每分钟从远程 URL 下载一个以当前日期为名称的 zip 文件(例如 2021-03-09.zip)到本地目录。 I have attached an email to receive cron output.我附加了一个 email 来接收 cron output。 The output is written below the command. output 写在命令下方。 I am using shared hosting with an apache server and PHP.我正在使用带有 apache 服务器和 PHP 的共享主机。

Command:命令:

* * * * * /usr/bin/wget -U "anyuser" http://example.com/directory/`date +%Y-%m-%d`.zip -O /home/username/public_html/directory/`date +%Y-%m-%d`.zip

Error:错误:

/bin/sh: -c: line 0: unexpected EOF while looking for matching ``'
/bin/sh: -c: line 1: syntax error: unexpected end of file

Finally after trying many thing I have found working answer.最后在尝试了很多事情之后,我找到了有效的答案。 I just need to escape % sign and the cron started working perfectly.我只需要转义 % 符号,cron 就开始完美地工作了。 Escaped all % sign with backslash and directadmin control panel started recognizing it.使用反斜杠转义所有 % 符号,directadmin 控制面板开始识别它。 Thank You.谢谢你。

* * * * * /usr/bin/wget -U "anyuser" http://example.com/directory/`date +\%Y-\%m-\%d`.zip -O /home/username/public_html/directory/`date +\%Y-\%m-\%d`.zip

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM