我是使用Linux shell脚本和cron的新手。如果我从命令行运行pubspg1.sh - 它运行得很好,但是在使用cron运行时 - 没有任何反应。也许我没有正确的脚本安装在cron中运行?注意:/ path ...是shell脚本的完整路径。shell脚本为cron执行多个shell脚本
在cron的,我有这样的:
30 22 * * 2 sh /path... /pubspg1.sh
pubspg1.sh脚本是这样的:
#!/usr/bin/bash
/usr/bin/sh /path... /pub1pg1.sh
/usr/bin/sh /path... /pub2pg1.sh
/usr/bin/sh /path... /pub3pg1.sh
/usr/bin/sh /path... /pub4pg1.sh
它应该是#!/ usr/bin/bash(在编辑你的shell脚本之前,确保/ usr/bin/bash存在) – Icarus3
您可以检查“sh”和“bash”是否确实在相同的路径上。点击“whereis sh”和“whereis bash” – Icarus3
我在编写脚本之前检查了路径......两者都位于/ usr/bin下。我用“哪个sh”和“哪个bash”。 –