Sunday, December 03, 2006

double loop script example

#!/bin/bash

i=0
for ID1 in $(awk -F":" '{print $2}' /tmp/components) ; do
id1[$i]=$ID1
i=$(($i+1))
done
j=0 ; while [ $j -lt $i ] ; do cmvt_component_os=${id1[$j]}; echo $cmvt_component_os ; j=$(($j+1)) ; done

Thursday, January 19, 2006

just a nice transfer script

Following
#!/bin/bash
#
#
#

og_log_id=$1.log

function og_xml_upp_ftp {
ftp -n << EOF
open server
user (your user)" "
lcd (your directory)
bin
hash
put $og_log_id.gz
bye
EOF
rm (your directory)$og_log_id.gz
}

function og_logs_compess {
cp (your directory)$og_log_id /xtr/log_xfer
gzip /xtr/log_xfer/$og_log_id
}


case $1 in
'xml')
og_logs_compess
og_xml_upp_ftp
;;
'console')
og_logs_compess
og_xml_upp_ftp
;;
'both')
og_log_id=xml.log
og_logs_compess
og_xml_upp_ftp
og_log_id=console.log
og_logs_compess
og_xml_upp_ftp
;;

*)
echo "Usage: $0 (your text)"
exit 1
;;
esac

Tuesday, January 10, 2006

making php interface to webinject

I`m useing webinject to check our application simple web page screated to provide interface to connect the tool to our support web site. web form executes php script and php executes perl of webinject and returnes the result file.

relevant php code:



the sw script content:
/xtr/scripts/webinject/swa/webinject.pl -c naga_config_server_id.xml >> /var/log/og_in.log

The configuration xml of webinject is set to normal output wich is redirected to log file i rotate daily. that both prevents output being returned to php code and gives me operation log on the use of the system.

Thats it,
Feodor ( Naor ) Weissmann