Okay, since I'm trying to learn gawk this was a good excercise! We've got oldlogfile containing 1st line is domain 1 and 2nd line is domain 2, I'm assuming.
and a gawkfile.gawk containing:
Code:
#!/usr/bin/gawk
##
## gawkfile.gawk
##
## Made by Barrie
## Login <barrie@localhost>
##
## Started on Tue Dec 29 16:50:14 2009 Barrie
##
{
for( i=1; i<=2; i++ )
datum[i]=$0
}
END {
print "Domain 1 " datum[1] " - Domain 2 " datum[2]
}
When we run:
Code:
gawk -f gawkfile.gawk ./oldlogfile > ./newlogfile
we get newlogfile looking like:
Code:
Domain 1 success - Domain 2 success
Don't know how yet but I'm sure we can put date/time stamps in there somewhere. ( still working on the custom logfile location/name thing)
Barrie
Edit: Still reading up on conditionals which implies that if either domain1 or domain2 is != "success" then we can generate an oops file somewhere, which a daemon can pick up and generate an email. Do you have postfix or something similar installed? - not to digress but I can think faster than I can type!
Bookmarks