2012-04-06 68 views
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/geoIPunix語句手動運行良好,但不通過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 

回答

2

因爲cronjobs往往與有限的「$運行PATH的嘗試是一樣的,但給你的geoIP應用程序的絕對路徑。

+0

另外,運行cronjob的用戶是否已經執行perm到/ Users/Admin/geoIP? – smassey 2012-04-06 13:59:48

+0

謝謝,就是它 – Jim 2012-04-06 15:04:14

+0

@jim如果答案是正確的,你應該接受它 – jordanm 2012-04-06 17:48:20

相關問題