Good dy to all.
Code:
#/bin/bash
while true
do
read LINE < /dev/ttyS0
echo $LINE >> /var/log/pbxcom/trace.txt;
eval $(echo $LINE | awk '{ Ommited to provide cleare text }')
echo "$data" >> /var/log/pbxcom/trace.txt;
sqlplus -s dsuleyman/dsuleyman@orcl << EOF
set echo off heading off feedback off pagesize 0
$data;
commit;
EOF
done
here is my sqcript on bash - the interesting situation that sometimes not so often I get garbage on LINE variable.
normal behavior is:
reading this string from comport
3/23/08 2:48PM 11 06 4388710 00:00'14" ....
then by awk creating SQL staements
INSERT INTO dsuleyman.CALLS_LOG (ID,CALL_DATE,EXTENSION,CO,DIR,PHONE_NUMBER,DURATION) VALUES (ID_INCREMENT.NEXTVAL ,TO_DATE('3/23/08 2:48PM','MM.DD.YY HH12:MiPM'),11,06,'O','4388710',T
O_DATE('00:00:14','HH24:Mi:SS'))
but sometimes happens next after first part of date
by some strange behave to string added all files locatong in the dir from whicj launched script
like this
3/24/08 a2ps.cfg a2ps-site.cfg acpi adjtime alchemist aliases aliases.db alsa alternatives anacrontab at.deny auto.master auto.misc auto.net bashrc blkid.tab bluetooth bonobo-activatio
n cdrecord.conf cpuspeed.conf cron.d cron.daily cron.deny cron.hourly cron.monthly crontab cron.weekly csh.cshrc csh.login cups dbus-1 default dev.d DIR_COLORS DIR_COLORS.xterm dumpdat
es enscript.cfg environment esd.conf exports fb.modes fdprm filesystems firmware fonts foomatic fstab gconf gnome gnome-vfs-2.0 gnome-vfs-mime-magic gpm-root.conf gre.conf group group-
grub.conf gshadow gshadow- gssapi_mech.conf gtk gtk-2.0 hal host.conf hosts hosts.allow hosts.deny hotplug hotplug.d httpd idmapd.conf im_palette.pal im_palette-small.pal im_palette-t
iny.pal imrc init.d initlog.conf inittab inputrc iproute2 isdn issue issue.net java jwhois.conf krb5.conf krb.conf krb.realms ldap.conf ld.so.cache ld.so.conf ld.so.conf.d ld.so.preloa
d lftp.conf libcwait.so libuser.conf lilo.conf.anaconda localtime log.d login.defs logrotate.conf logrotate.d lsb-release ltrace.conf lvm mail mailcap mail.rc makedev.d man.config mget
ty+sendfax mime-magic mime-magic.dat mime.types minicom.users modprobe.conf modprobe.conf~ modprobe.conf.dist motd mtab mtools.conf netplug netplug.d nohup.out nscd.conf nsswitch.conf
ntp ntp.conf odbc.ini odbcinst.ini openldap opt oraInst.loc oratab pam.d pam_smb.conf pango paper.config passwd passwd- passwd.OLD pbm2ppa.conf pcmcia pear.conf php.d php.ini pinforc p
nm2ppa.conf ppp prelink.cache prelink.conf printcap profile profile.d protocols pwdb.conf quotagrpadmins quotatab racoon rc rc0.d rc1.d rc2.d rc3.d rc4.d rc5.d rc6.d rc.d rc.local rc.s
ysinit readahead.early.files readahead.files redhat-lsb redhat-release resolv.conf rhgb rmt rpc rpm samba screenrc scrollkeeper.conf scsi_id.config securetty security selinux sensors.c
onf services services.NBU_022708.20:37:55 sestatus.conf setuptool.d sgml shadow shadow- shadow.OLD shells skel smartd.conf smrsh snmp sound sqlnet.log ssh stunnel sudoers sysconfig sys
ctl.conf syslog.conf termcap tux.mime.types udev updatedb.conf vfontcap vimrc vsftpd vsftpd.ftpusers vsftpd.user_list vx warnquota.conf webalizer.conf webalizer.conf.sample wgetrc wvdi
al.conf X11 xdg xinetd.conf xinetd.d xml yp.conf zlogin zlogout zprofile zshenv zshrc
1:11PM 17 01 < incoming > 00:00'37" ....
ofcourse now awk cant normaly parse it - meybe somebody knows from where this garbage comes?