Shell 脚本(.sh 文件)无法在 crontab 中运行,但它可以单独运行
Shell script (.sh file) not working in crontab but it's working alone
30 11 * * * /home/ubuntu/Projects/scripts/Sample.sh
并且 syslog
文件包括:
Jun 28 11:30:01 ip-10-98-125-10 CRON[4225]: (tomcat7) CMD
(/home/ubuntu/Projects/scripts/Sample.sh)
请帮帮我;我一直卡在上面!
这里我们需要指定shell命令到运行脚本。
30 11 * * * sh /home/ubuntu/Projects/scripts/Sample.sh
很明显,您甚至不能在 shell 行中使用 运行 /home/ubuntu/Projects/scripts/Sample.sh
。
因为我们需要 运行 ./home/ubuntu/Projects/scripts/Sample.sh
(仅当 Smaple.sh 可执行)或 sh /home/ubuntu/Projects/scripts/Sample.sh
所以不要忘记 sh
或 bash
。
30 11 * * * /home/ubuntu/Projects/scripts/Sample.sh
并且 syslog
文件包括:
Jun 28 11:30:01 ip-10-98-125-10 CRON[4225]: (tomcat7) CMD (/home/ubuntu/Projects/scripts/Sample.sh)
请帮帮我;我一直卡在上面!
这里我们需要指定shell命令到运行脚本。
30 11 * * * sh /home/ubuntu/Projects/scripts/Sample.sh
很明显,您甚至不能在 shell 行中使用 运行 /home/ubuntu/Projects/scripts/Sample.sh
。
因为我们需要 运行 ./home/ubuntu/Projects/scripts/Sample.sh
(仅当 Smaple.sh 可执行)或 sh /home/ubuntu/Projects/scripts/Sample.sh
所以不要忘记 sh
或 bash
。