1
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
爲什麼我的語句中的geoIP腳本在使用launchd或cron時不會被調用?它手動運行良好...我試圖把完整的路徑爲GEOIP 像~/geoIP
或./geoIP
或/Users/Admin/geoIP
unix語句手動運行良好,但不通過launchd或cron
#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
另外,運行cronjob的用戶是否已經執行perm到/ Users/Admin/geoIP? – smassey 2012-04-06 13:59:48
謝謝,就是它 – Jim 2012-04-06 15:04:14
@jim如果答案是正確的,你應該接受它 – jordanm 2012-04-06 17:48:20