Bash unix语句可以手动运行,但不能通过launchd或cron运行

Bash unix语句可以手动运行,但不能通过launchd或cron运行,bash,Bash,为什么在我使用launchd或cron时,语句中的geoIP脚本没有被调用?手动运行正常。。。我试着为geoIP提供完整的路径 例如~/geoIP或/geoIP或/Users/Admin/geoIP egrep -w 'TCP|UDP' ~/IPsDenied.txt | sed 's/:[^:]* in/ in/' | awk '{cmd="echo "$5" | geoIP | fgrep 'Country:' | cut -c 16-43"; cmd | getline rslt; clo

为什么在我使用launchd或cron时,语句中的geoIP脚本没有被调用?手动运行正常。。。我试着为geoIP提供完整的路径 例如
~/geoIP
/geoIP
/Users/Admin/geoIP

egrep -w 'TCP|UDP' ~/IPsDenied.txt | sed 's/:[^:]* in/ in/' | awk '{cmd="echo "$5" | geoIP | fgrep 'Country:' | cut -c 16-43"; cmd | getline rslt; close(cmd); print $1" "$2" "$3" "$4" "$5" "$6" "rslt}' >> ~/IPtoCountry.txt
相反,我得到的只是

#IPsDenied.txt
Apr 6 08:58:16 TCP 212.58.244.61:80 in

#IPtoCountry.txt
Apr 6 08:58:16 TCP 212.58.244.61 in United Kingdom

因为cronjob通常使用有限的“$PATH”运行,所以请尝试相同的方法,但为您的geoIP应用程序提供绝对路径。

此外,运行cronjob的用户是否已执行perm to/Users/Admin/geoIP?
Apr 6 08:58:16 TCP 212.58.244.61