simple grep_hostname worker
authorDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 May 2010 12:37:46 +0000 (12:37 +0000)
committerDobrica Pavlinusic <dpavlin@rot13.org>
Sat, 1 May 2010 12:37:46 +0000 (12:37 +0000)
git-svn-id: svn://svn.rot13.org/sysadmin-cookbook@202 191e9f34-6774-4a6d-acfc-7664dacd4a2a

recepies/gearman/grep_logs.sh [new file with mode: 0755]

diff --git a/recepies/gearman/grep_logs.sh b/recepies/gearman/grep_logs.sh
new file mode 100755 (executable)
index 0000000..826485b
--- /dev/null
@@ -0,0 +1,11 @@
+#!/bin/sh -x
+
+# echo 'error' | gearman -f grep_logs
+
+if [ -z "$1" ] ; then
+       hostname=`hostname`
+       exec /srv/gearmand/bin/gearman -h 10.60.0.244 -w -f grep_$hostname $0 $hostname
+fi
+
+read pattern
+grep $pattern /var/log/*.log