This message is in MIME format. Since your mail reader does not understand this format, some or all of this message may not be legible. ------_=_NextPart_001_01C0F364.DE9C2C70 Content-Type: text/plain ok. the silence from the list pushed me to get this script working, and i did. the problem was not with the system function, but with the $CMD in the system call. here's the corrected system calls: ... if(error[$0]) { system("cp -p err.alert err.alert.`date +%m%d%y.%S`"); system("mailx -s "$0" rick.francis@transora.com</dev/null"); } }' $F0 $F1 exit 0 Would ANyone have an idea how to enhance this script by redirecting the name of the file $0 matched in the email? rf __________________________ original post: in this script, the printf works if $0 is returned, but the two (2) system("$CMD") lines are skipped and not read; any ideas, any help? ______________________________________________________ #!/usr/bin/sh P=/usr/bin DATE='date +%m%d%y.%S' FF=/usr/home/rfrancis F0=/var/adm/messages F1=/var/log/syslog /usr/bin/awk ' BEGIN { error["full"] = 1; error["fault"] = 1; } { if(error[$0]) { printf("Match: %s\n",$0); system("$P/cp -p $FF/err.alert $FF/err.alert.$DATE"); system("$P/mailx -v -s err.alert rick.francis@transora.com<err.alert"); } }' $F0 $F1 exit 0 ------------------------------------------------------ what is it about the system("$CMD") call; should it be something else; i've tried exec, command??? thanks again. rf The information transmitted is intended only for the person or entity to which it is addressed and may contain confidential and/or privileged material. Any review, retransmission, dissemination or other use of, or taking of any action in reliance upon, this information by persons or entities other than the intended recipient is prohibited. If you received this in error, please contact the sender and delete the material from any computer. ------_=_NextPart_001_01C0F364.DE9C2C70 Content-Type: text/html Content-Transfer-Encoding: quoted-printable <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN"> <HTML> <HEAD> <META HTTP-EQUIV=3D"Content-Type" CONTENT=3D"text/html; = charset=3DUS-ASCII"> <META NAME=3D"Generator" CONTENT=3D"MS Exchange Server version = 5.5.2653.12"> <TITLE>SUMMARY: awk script fails</TITLE> </HEAD> <BODY> <P><FONT SIZE=3D2>ok. the silence from the list pushed me to get this = script working, and i did.</FONT> <BR><FONT SIZE=3D2>the problem was not with the system function, but = with the $CMD in the system call.</FONT> <BR><FONT SIZE=3D2>here's the corrected system calls:</FONT> <BR><FONT SIZE=3D2>...</FONT> <BR> <FONT = SIZE=3D2>if(error[$0]) </FONT> <BR> <FONT SIZE=3D2>{</FONT> <BR> <FONT = SIZE=3D2>system("cp -p err.alert err.alert.`date = +%m%d%y.%S`");</FONT> <BR> <FONT = SIZE=3D2>system("mailx -s "$0" = rick.francis@transora.com</dev/null");</FONT> <BR> <FONT SIZE=3D2>}</FONT> <BR><FONT SIZE=3D2>}' $F0 $F1</FONT> <BR><FONT SIZE=3D2>exit 0</FONT> </P> <P><FONT SIZE=3D2>Would ANyone have an idea how to enhance this script = by redirecting the name of the file $0 matched in the email?</FONT> </P> <P><FONT SIZE=3D2>rf</FONT> </P> <P><FONT SIZE=3D2>__________________________</FONT> <BR><FONT SIZE=3D2>original post:</FONT> <BR><FONT SIZE=3D2>in this script, the printf works if $0 is returned, = but the two (2) system("$CMD") lines are skipped and not = read; any ideas, any help?</FONT></P> <P><FONT = SIZE=3D2>______________________________________________________</FONT> <BR><FONT SIZE=3D2>#!/usr/bin/sh</FONT> <BR><FONT SIZE=3D2>P=3D/usr/bin</FONT> <BR><FONT SIZE=3D2>DATE=3D'date +%m%d%y.%S'</FONT> <BR><FONT SIZE=3D2>FF=3D/usr/home/rfrancis</FONT> <BR><FONT SIZE=3D2>F0=3D/var/adm/messages</FONT> <BR><FONT SIZE=3D2>F1=3D/var/log/syslog</FONT> <BR><FONT SIZE=3D2>/usr/bin/awk '</FONT> <BR> <FONT SIZE=3D2>BEGIN = {</FONT> <BR> = <FONT = SIZE=3D2>error["full"] =3D 1;</FONT> <BR> = <FONT = SIZE=3D2>error["fault"] =3D 1;</FONT> <BR> = <FONT SIZE=3D2>}</FONT> <BR><FONT SIZE=3D2>{</FONT> <BR> <FONT = SIZE=3D2>if(error[$0]) </FONT> <BR> <FONT SIZE=3D2>{</FONT> <BR> <FONT = SIZE=3D2>printf("Match: %s\n",$0);</FONT> <BR> <FONT = SIZE=3D2>system("$P/cp -p $FF/err.alert = $FF/err.alert.$DATE");</FONT> <BR> <FONT = SIZE=3D2>system("$P/mailx -v -s err.alert = rick.francis@transora.com<err.alert");</FONT> <BR> <FONT SIZE=3D2>}</FONT> <BR><FONT SIZE=3D2>}' $F0 $F1</FONT> <BR><FONT SIZE=3D2>exit 0</FONT> <BR><FONT = SIZE=3D2>------------------------------------------------------</FONT> </P> <P><FONT SIZE=3D2>what is it about the system("$CMD") call; = should it be something else; i've tried exec, command???</FONT> <BR><FONT SIZE=3D2>thanks again.</FONT> <BR><FONT SIZE=3D2>rf</FONT> </P> <BR> <BR> <P><FONT SIZE=3D2>The information transmitted is intended only for the = person or entity to which it is addressed and may contain confidential = and/or privileged material. Any review, retransmission, = dissemination or other use of, or taking of any action in reliance = upon, this information by persons or entities other than the intended = recipient is prohibited. If you received this in error, please = contact the sender and delete the material from any = computer.</FONT></P> </BODY> </HTML> ------_=_NextPart_001_01C0F364.DE9C2C70--Received on Tue Jun 12 18:26:52 2001
This archive was generated by hypermail 2.1.8 : Wed Mar 23 2016 - 16:24:56 EDT