/bin/sh: -c: 第 0 行:在寻找匹配的“”时出现意外的 EOF
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
Cron 无法 运行 工作并向我发送这封电子邮件:
标题:
cd /var/www/www-root/data/www/mysite.com/laravel/ && find ./ -mtime -1 -type f -printf "
body:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
我正在使用 ISPmanager,这是 cron 作业:
cd /var/www/www-root/data/www/mysite.com/nuxt/ && find ./ -mtime -1 -type f -printf "%p\n" | while read name ; do zip /var/www/www-root/data/www/mysite.com/laravel/storage/app/backup/nuxt_files.zip $name; done
该代码在 ssh bash 中运行完美,即使我通过在 ISPmanager 中按 "run" 按钮 运行 该 cron 作业。我不知道 cron 有什么问题。
cron
在将命令发送到 shell 之前将 %
替换为换行符。要包含文字 %
,您需要将其转义:
cd /var/www/www-root/data/www/mysite.com/nuxt/ &&
find ./ -mtime -1 -type f -printf "<b>\%</b>p\n" |
while read name ; do
zip /var/www/www-root/data/www/mysite.com/laravel/storage/app/backup/nuxt_files.zip $name; done
来自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.
因此您正在尝试 运行 使用 p\n" ...
作为其输入的第一个命令(具有不匹配的 "
)。
Cron 无法 运行 工作并向我发送这封电子邮件:
标题:
cd /var/www/www-root/data/www/mysite.com/laravel/ && find ./ -mtime -1 -type f -printf "
body:
/bin/sh: -c: line 0: unexpected EOF while looking for matching `"'
/bin/sh: -c: line 1: syntax error: unexpected end of file
我正在使用 ISPmanager,这是 cron 作业:
cd /var/www/www-root/data/www/mysite.com/nuxt/ && find ./ -mtime -1 -type f -printf "%p\n" | while read name ; do zip /var/www/www-root/data/www/mysite.com/laravel/storage/app/backup/nuxt_files.zip $name; done
该代码在 ssh bash 中运行完美,即使我通过在 ISPmanager 中按 "run" 按钮 运行 该 cron 作业。我不知道 cron 有什么问题。
cron
在将命令发送到 shell 之前将 %
替换为换行符。要包含文字 %
,您需要将其转义:
cd /var/www/www-root/data/www/mysite.com/nuxt/ &&
find ./ -mtime -1 -type f -printf "<b>\%</b>p\n" |
while read name ; do
zip /var/www/www-root/data/www/mysite.com/laravel/storage/app/backup/nuxt_files.zip $name; done
来自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.
因此您正在尝试 运行 使用 p\n" ...
作为其输入的第一个命令(具有不匹配的 "
)。