Skip to main content

Posts

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
Recent posts

VBScript for compressing files in a folder and send on FTP

This is a simple vbscript compression script. works flawlessly on text files even bigger than 15GB. We have a SSIS data generation package installed on our DB server which generates huge data files for data mining operations for current year, current month. The below scripts are doing the rest; compress the files and FTP to the data mining server location.   '====================================================== ' Function : Zip datamart CSV, CTL files to local server for archive purposes. '====================================================== Function WindowsZip(sFile, sZipFile, szPath, szDate)   Set oZipShell = CreateObject("WScript.Shell")    Set oZipFSO = CreateObject("Scripting.FileSystemObject")   Set LogFile = oZipFSO.CreateTextFile(szPath & "\Logs\log_" & szDate & ".log", true)   LogFile.WriteLine("=======================================")   LogFile.WriteLine(Now & " - Com

VBScript for URL link creation

We had a need to create URL link of our project on users's desktop using a script. First stage the users had enough rights on their PC's so we included the required icon file also with the script and passed the following VBScript to users to click on it to create the desktop icon link. ' Definie shell object Set objWSHShell = WScript.CreateObject("Wscript.Shell") strDesktop = objWSHShell.SpecialFolders("Desktop") ' Copy the icon file to windows Set objFSO = CreateObject("Scripting.FileSystemObject") Set objFileCopy = objFSO.GetFile( objWSHShell.CurrentDirectory&"\icon.ico") objFileCopy.Copy ("C:\WINDOWS\system32\") ' Define link properties and create link strShortcutName = "Log In" ' Shortcut Name - Edit for the wanted name strShortcutPath = "http://thesystem.com/Login.aspx" ' Link URL - Edit to the wanted URL strIconPath = "C:\WINDOWS\syst

ASP.NET default Login page and controller modification for using with Web Service or local method

By default the ASP.NET login page and controls are bound with default methods and its bit uneasy to work with ( at least for some ppl like me). We could make use of same controller and pages with our own mechanism of logging in. 1. Changes on web.config <location path="Login.aspx">     <system.web>       <authorization>         <allow users="*" />       </authorization>     </system.web>   </location>   <location path="Styles">     <system.web>       <authorization>         <allow users="*" />       </authorization>     </system.web>   </location>   <location path="Images">     <system.web>       <authorization>         <allow users="*" />       </authorization>     </system.web>   </location>   <system.web>     <authorization>       <d

ASP.NET - Almost complete use of Datagrid

I was on a need of creating datagrid object on my page with sorting, filtering, updating needs. You could make use of below example for some complex cases (Dropdown, Date selector update columns for relational data table updates, filters, multiple update queries)     <table border="0" cellspacing="0">         <tbody> <tr>         <th>Owner_Name</th>         <th>OS</th>         <th>Type</th>         <th>Status</th>         <th>Action Type</th>         </tr> <tr>         <td><asp:dropdownlist appenddatabounditems="true" autopostback="true" datasourceid="dsPopulateOwner_Name" datatextfield="UNAME" datavaluefield="UID" font-size="11px" id="ddlOwner_Name" runat="server" width="130px">             <asp:listitem text="*" value="%">&

MSSQL Split, Pad Zeroes, Get Alphabets, and Substring

Got a request to create a data table get from some existing data to some required data formatting. The Source data is like 'C10 L1_B21773197D.xls', 'EV1 L1_B21773602F.xls', 'EV116 L1_B21773659G.xls', etc. The following were the requirements. CategoryCode No NVARCHAR(10) C Contained in legacy data file name Sample legacy data file name : “ C 10 L1_B21773197D ” 1.        Alphabets prior to Numeric characters) FolderNo No VARCHAR(10) C001 Contained in legacy data file name Sample legacy data file name : “ C 10 L1_B21773197D ” 1.        convert numeric characters prior to “white space” to a 3 digit number (e.g. “1” --> “001”) 2.        Append 3 digit number to Category Code VolumeNo No VARCHAR(10) C001L01 Contained in legacy data file name Sample legacy data file name : “ C10 L1_B21773197D ” 1.        Extract the 2 nd occurrence of an Alphabets in Fil

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