Skip to main content

Posts

Showing posts from September, 2010

MySQL Dump cronjob on linux server

Creating mysql dump for production databases is very important. In case of any failure or malefic attack on DB, The only way to restore to previous state is by having proper mysql dump file. Follows an example mysql dump shell script with auto naming with dumping time stamp. Its important to create the shell scripts in unix mode, if you create on a PC, It'll add some unwanted character encoding, and it'll lead to some erroneous response on the script. #!/bin/bash today=`date +%Y%m%d%H%M` backup="cmtdbbackup-$today.sql" mysqldump -u user -ppassword mydb > /apps/mysql_dump/$backup Its important to create the shell script carefully. No spaces, unless its required. in between -u and user name, there is a space, but no space between -p and password. As per the usage of system, we can decide on which interval the cronjob could be set. normally the format of a crontab entry is like the following. * * * * * /apps/scripts/scheduled_job.sh >> /dev/null 2>&am

building SOAP object in perl to call a web service

Follows an example perl script snippet structure to build SOAP object to call a web service Use the required library use SOAP::Lite +trace => 'debug'; Define the SOAP object my $soap = SOAP::Lite                    -> uri('http://localhost:1325/WSImpl/')                    -> on_action( sub { return '"http://www.example.com/ws/MaterialService:updateMaterialIn"' } )                    -> proxy('http://localhost:1325/WSImpl/MaterialService.asmx')                    -> on_fault(sub { my($soap, $res) = @_;              die ref $res ? $res->faultdetail : $soap->transport->status, "\n";            }); Define the SOAP method my $method = SOAP::Data->name('UpdateMaterialRequest')             ->attr({xmlns => 'http://www.example.com/ws/MaterialService'}); Build the SOAP query data my $query = SOAP::Data->value(     SOAP::Data->name(ServiceTags =>     \SOAP::Data-&g