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
为什么在使用launchd或cron时,我的语句中的geoIP脚本不会被调用?它手动运行良好...我尝试将完整的PATH用于geoIP
例如~/geoIP
或./geoIP
或/Users/Admin/geoIP
#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
相反,我只是
Apr 6 08:58:16 TCP 212.58.244.61
答案 0 :(得分:2)
因为cronjobs经常以有限的'$ PATH'运行,所以尝试相同但给出你的geoIP应用程序的绝对路径。