Printable Version of Topic

Click here to view this topic in its original format

Linuxhelp _ Technical Support _ Debian5 crontab running .sh help

Posted by: ekun Jan 21 2011, 11:06 AM

i have a .sh script that contains the following:

#!/usr/bin/sh
/bin/echo IP: > /home/user/public_html/fail2ban.txt
/bin/zgrep -h "Ban " /var/log/fail2ban.log* | awk '{print $NF}' | sort | logres$
/bin/echo SUBNETS: >> /home/user/public_html/fail2ban.txt
/bin/zgrep -h "Ban " /var/log/fail2ban.log* | awk '{print $NF}' | awk -F\. '{pr$
/bin/echo SERVICES: >> /home/user/public_html/fail2ban.txt
/bin/grep "Ban " /var/log/fail2ban.log | awk -F[\ \:] '{print $10,$8}' | sort |$
/bin/echo TODAY: >> /home/user/public_html/fail2ban.txt
/bin/grep "Ban " /var/log/fail2ban.log | grep `date +%Y-%m-%d` | awk '{print $NF}' | sort | awk '{print $1,"("$1")"}' | logresolve | uniq -c | sort >> /home/user/public_html/fai$

(just some fail2ban.log filtering and dysplay)

then have on contrab this

*/1 * * * * /root/fail2ban.sh >/dev/null 2>&1

the script doesnt work with contrab, if i run it manually it works.. can someone give some help pls?

ty in advance

Posted by: michaelk Jan 23 2011, 05:42 PM

You might want to include the full path for uniq and sort.

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)