Link to Flash Quran Tamil Dictionary
Tamil Dictionary
http://www.ildc.in/tamil/GIST/htm/dictionary.htm
Flash Quran
http://www.quranflash.com/books/Medina1/?en#.UiAgShMWZXw
==========================================================
Alertmail.vbs
on error resume next
alertfor = wscript.arguments(0)
data = wscript.arguments(1)
runningon = wscript.arguments(2)
scheduledat = wscript.arguments(3)
startat= wscript.arguments(4)
endat = wscript.arguments(5)
status = wscript.arguments(6)
filearg = wscript.arguments(7)
dim log_description,logfile
if alertfor = "Websites Database Backup" then
fromname = "Websites DB Backup"
elseif alertfor = "India Onsite Backup - QCPre3" then
fromname = "Onsite Backup - India"
elseif alertfor = "US Onsite Backup" then
fromname = "Onsite Backup - US"
elseif alertfor = "IT Share Sync" then
fromname = "IT Share Sync"
else
fromname = "Sync Process"
end if
if instr(filearg,"/RLOG:") > 0 then
theleft = instr(filearg,"/RLOG:")
logfile = mid(filearg,theleft+6)
Read_Robocopy_logfile
elseif instr(filearg,"/XLOG:") > 0 then
theleft = instr(filearg,"/XLOG:")
logfile = mid(filearg,theleft+6)
Read_QXchange_logfile
elseif instr(filearg,"/DLOG:") > 0 then
theleft = instr(filearg,"/DLOG:")
logfile = mid(filearg,theleft+6)
Read_DTSpackage_logfile
end if
fromemailid = chr(34) & fromname & chr(34) &"it_support@cellarstone.com"
toemailid = "sajin_c@cellarstone.com"
'toemailid = "it_support@cellarstone.com"
'toemailid = "swaminathan_ramachandran@cellarstone.com"
'ccemailid = "swaminathan_ramachandran@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
subjectmsg = alertfor
'****************** Email format **********************
alertemail = "<html>" &_
"<head>" &_
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>" &_
"<title>IT Alerts</title>" &_
"<style type='text/css'>" &_
".style1 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;}" &_
".boldtext {font-family:Verdana, Arial, Helvetica, sans-serif;color: #FF0000; font-size:11px; font-weight:bolder;}" &_
".style2 {color: #FFFFFF;font-weight: bold;}" &_
".style3 {color: #FFFFFF;font-size: 12px;}" &_
".style4 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-weight:bold}" &_
".error-alert {color: #FF0000}" &_
"</style>" &_
"</head><body>" &_
"<table width='61%' border='1' cellpadding='0' cellspacing='1' bordercolor='#CCCCCC' class='style1'>" &_
"<tr><td height='30' colspan='4'><table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' class='style1'>" &_
"<tr bgcolor='#0086B3' class='style1'>" &_
"<td width='17%' class='style1'><span class='style2'>Alert For</span></td>" &_
"<td width='83%'><span class='style3'>" & alertfor & "</span></td></tr>" &_
"</table></td></tr>" &_
"<tr>" &_
"<td width='17%' height='20' bgcolor='#EEF3F9'>Data</td><td width='32%'>" & data & "</td>" &_
"<td width='17%' bgcolor='#EEF3F9'>Start Time </td><td width='34%'>" & startat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Running On </td><td>" & runningon & "</td>"&_
"<td bgcolor='#EEF3F9'>End Time </td><td>" & endat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Scheduled Time </td><td>" & scheduledat & "</td>" &_
"<td bgcolor='#EEF3F9'>Status</td><td>" & status & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4'> </td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4' bgcolor='#EEF3F9'>Log / Error Description</td>" &_
"</tr>" &_
"<tr valign='top'>" &_
"<td height='88' colspan='4'>" & log_description &"</td>" &_
"</tr>" &_
"</table>" &_
"</body>" &_
"</html>"
'********************* END ALERT EMAIL FORMAT **********************
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.CC = ccemailid
objEmail.Subject = subjectmsg
objEmail.HTMLbody = alertemail
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
'*****************PARSING ROBOCOPY LOG FILE*****************
sub Read_Robocopy_Logfile()
Dim arrFileLines()
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
if instr(arrFileLines(i),"Total") > 0 AND instr(arrFileLines(i),"Copied") > 0 Then
status = "Completed"
startline = i+1
else
startline = 0
end if
i = i + 1
Loop
objFile.Close
log_description = "emptyline--"
if startline = 0 then startline = i-9
For l = startline to i-1 step 1
log_description = log_description & "<BR>" & arrFileLines(l)
Next
log_description = replace(log_description,"emptyline--<BR>","")
log_description = "<pre>" & log_description & "</pre>"
End sub
'*****************PARSING QXCHANGE LOG FILE*****************
Sub Read_Qxchange_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Inserted Records </td><td>Error Records</td></tr>"
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load(logfile)
Set Log_Date = objXMLDoc.selectSingleNode("LogReport/Log/LogDate")
Set Log_Time = objXMLDoc.selectSingleNode("LogReport/Log/LogTime")
Set Total_Records = objXMLDoc.selectSingleNode("LogReport/Log/Total_Records")
Set Inserted_Records = objXMLDoc.selectSingleNode("LogReport/Log/Inserted_Records")
Set Error_Records = objXMLDoc.selectSingleNode("LogReport/Log/Error_Records")
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
totalrecords = split(Total_Records.Text, ",")
insertedrecords = split(Inserted_Records.Text, ",")
errorrecords = split(Error_Records.Text, ",")
for i=0 to Ubound(totalrecords) step 1
theright = instr(totalrecords(i)," - ")
tablename = left(totalrecords(i),theright)
totalrec = mid(totalrecords(i),theright+3)
insertedrec = mid(insertedrecords(i),theright+3)
errorrec = mid(errorrecords(i),theright+3)
if errorrec > 0 then errorrec = "<span class='error-alert'>"& errorrec &"</span>"
log_description = log_description & "<tr><td>"& tablename &"</td><td>"& totalrec &"</td><td>"& insertedrec & "</td><td>"& errorrec &"</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
'*****************PARSING DTS PACKAGE LOG FILE*****************
Sub Read_DTSpackage_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Status </td></tr>"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
strline = objFile.ReadLine
if instr(strline,"Step 'Copy Data from") > 0 Then
tablename = tablename & "," & mid(strline,instr(strline,"from ")+5,instr(strline," to [")-instr(strline,"from ")-5)
rec_status = rec_status & "," & mid(strline,instr(strline,"Step'")+6)
'log_description = log_description & tablename & " - " & rec_status & " - "
end if
if instr(strline,"Progress count in Step:") > 0 Then
'log_description = log_description & mid(strline,instr(strline,"Step:")+6) & vbcrlf
no_of_records = no_of_records & "," & mid(strline,instr(strline,"Step:")+6)
end if
Loop
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
tablename_list = split(tablename, ",")
no_of_records_list = split(no_of_records, ",")
rec_status_list = split(rec_status, ",")
for i=1 to Ubound(tablename_list) step 1
table_name = tablename_list(i)
record_count = no_of_records_list(i)
record_status = rec_status_list(i)
if record_status = "failed" then record_status = "<span class='error-alert'>"& record_status &"</span>"
log_description = log_description & "<tr><td>"& table_name &"</td><td>"& record_count &"</td><td>"& record_status & "</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
====================================================================
exclude_file.txt
D:\XXX\Sample\*.*
D:\ XXX \SQL Data\*.*
D:\ XXX \LogDir\*.*
D:\ XXX \LogDir\Log\*.*
D:\ XXX \AppDataDir\TempDir\*.*
D:\ XXX \Customer Data\*.*
D:\ XXX \AppDataDir\ArDir\*.*
==================================================================
copy_data.vbs
On Error Resume Next
Const ForReading = 1
error = 0
exiterror = 0
subjectmsg = ""
alertmsg = ""
strComputer = "."
subjectmsg1 = ""
desc=""
if wscript.arguments.count < 3 then
wscript.echo "Usage : Copy_Data.vbs <Description> <Source Path> <Destination Path>"
else
desc = wscript.arguments(0)
sourcepath = wscript.arguments(1)
destpath = wscript.arguments(2)
runningon = "-"
scheduledat = "Daily"
filename = "C:\scripts\Log\Backup-Robocopy_Log"
'ACCESS INFORMATION END
fromemailid = chr(34) & desc& " Backup" & chr(34) & "it_support@cellarstone.com"
toemailid = "sajin_c@cellarstone.com"
'toemailid = "it_support@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
sync_data = "robocopy " & chr(34) & sourcepath & chr(34) & " " & chr(34) & destpath & chr(34) & " /V /E /Z /R:10 /W:30 /Log:"
Start_Monitor_Syncprocess()
end if
Sub Start_Monitor_Syncprocess()
Set objShell = CreateObject("Wscript.Shell")
dim monthval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
min = Minute(Time)
if min<10 then min = "0" & min
sec = Second(Time)
if sec<10 then sec = "0" & sec
hr = Hour(Time)
if hr<10 then hr = "0" & hr
timeval = hr&min&sec
currenttime = dateval & "_" & timeval
logfile = filename & currenttime & ".txt"
startat = now()
objShell.Run sync_data&logfile,1,True
endat = now()
sendalertemail = " " & chr(34) & "India Onsite Backup - QCPre3" & chr(34) &" "& chr(34) & desc & chr(34) &_
" " & chr(34) & runningon & chr(34) & " " & chr(34) & scheduledat & chr(34) & " "& chr(34) & startat & chr(34) &_
" "& chr(34) & endat & chr(34) & " " & chr(34) & status & chr(34) & " " & chr(34) & "/RLOG:"& logfile & chr(34)
'wscript.echo sendalertemail
objShell.Run "wscript.exe alert_email.vbs" & sendalertemail ,1,True
end sub
sub sendalert(subjectmsg, alertmsg)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.cc = ccemailid
objEmail.Subject = subjectmsg &" - " & Now
objEmail.HTMLbody = alertmsg
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end sub
===============================================================
Hosted_CustomerData_XXX.vbs
'On Error Resume Next
Const ForReading = 1
error = 0
exiterror = 0
subjectmsg = ""
alertmsg = ""
strComputer = "."
subjectmsg1 = ""
destrootpath = "D:\Customer_Data\Backup\CRL"
destpath = "D:\Customer_Data\Backup\CRL"
exclude_list = "C:\scripts\exclude_files.txt"
dim monthval
dim dayval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
dayval = Array ("","Sun","Mon","Tue","Wed","Thu","Fri","Sat")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
bkpfolder = date1 & monthval(Month(Date)) & Year(Date)
Set objShell = CreateObject("Wscript.Shell")
'DISPLAY PROGRESS BAR
Set FSO = CreateObject("Scripting.FileSystemObject")
IF FSO.FolderExists("D:\CRL") then
sourcepath = "D:\CRL"
destpath = destpath & "\" & bkpfolder & "_QCommission"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
IF FSO.FolderExists("C:\home12") then
sourcepath = "C:\Users\Public\Documents\QCommission Pro"
destpath = destpath & "\" & bkpfolder & "_QCommission Pro"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
IF FSO.FolderExists("C:\home22") then
sourcepath = "C:\Users\Public\Documents\QCommission Premier"
destpath = destpath & "\" & bkpfolder & "_QCommission Premier"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
'objExplorer.Document.Body.InnerHTML = "Your logoff script is now complete."
Tamil Dictionary
http://www.ildc.in/tamil/GIST/htm/dictionary.htm
Flash Quran
http://www.quranflash.com/books/Medina1/?en#.UiAgShMWZXw
https://www.google.co.in/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&cad=rja&ved=0CCwQFjAA&url=http%3A%2F%2Fwww.lanka.info%2Fdictionary%2FEnglishToSinhala.jsp&ei=HyUgUo-ZFofprAeh_IGIBA&usg=AFQjCNEW7IrB2ww7uoEtSb_2eTpgZZO3jQ&sig2=rByJ9hDfvG0wm4qcO9NMYw&bvm=bv.51495398,d.bmk
Scripts
To Delete file Based on No:Delete files based on created date.vbs file
dim del_folder
dim file_type
dim no_of_days
count = 0
skipcount = 0
if wscript.arguments.count < 3 then
wscript.echo "Usage : Delete files based on created date.vbs <path> <file type> <no of days>"
else
del_folder = wscript.arguments(0)
file_type = wscript.arguments(1)
no_of_days = wscript.arguments(2)
no_of_days = cint(no_of_days)
Set FSO = CreateObject("Scripting.FileSystemObject")
Set ObjFolder = FSO.GetFolder(del_folder)
dim monthval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
min = Minute(Time)
if min<10 then min = "0" & min
sec = Second(Time)
if sec<10 then sec = "0" & sec
hr = Hour(Time)
if hr<10 then hr = "0" & hr
timeval = hr&min&sec
currenttime = dateval & "_" & timeval
logfilename = "C:\scripts\logs\folder_Cleanup_Log_" & currenttime & ".txt"
Set objlogfile = FSO.createTextFile(logfilename, 2)
ShowSubfolders objFolder
objlogfile.writeline
objlogfile.writeline "------------------------------------------------------------" & vbcrlf
objlogfile.writeline "Number of Files deleted : " & Count & vbcrlf
objlogfile.writeline "------------------------------------------------------------" & vbcrlf
objlogfile.close
Set objlogfile = FSO.OpenTextFile(logfilename,1)
alertmsg = objlogfile.ReadAll
Set objEmail = CreateObject("CDO.Message")
objEmail.From = "it_support@cellarstone.com"
objEmail.To = "implementation_group_india@cellarstone.com"
objEmail.CC = "it_support@cellarstone.com"
objEmail.Subject = "FTP_Cleanup - " & Now & " EST"
objEmail.textbody = alertmsg
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "mail.cellarstone.com"
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end if
Sub ShowSubFolders(Folder)
For Each objFile in Folder.Files
strfile = folder.path & "\" & objFile.name
'wscript.echo strfile
extension = FSO.GetExtensionName(objFile.name)
deletefile strfile, extension
next
For Each Subfolder in Folder.SubFolders
'Wscript.Echo Subfolder.Path
ShowSubFolders Subfolder
Next
End Sub
Sub deletefile (filename,filetype)
Set objFile1 = FSO.GetFile(filename)
createdate = objFile1.DateCreated
create_date = DateDiff("d",createdate,Now)
if create_date > no_of_days then
if StrComp(filetype,file_type,1) = 0 OR file_type="*" then
count = count + 1
objlogFile.WriteLine filename & " - Created Date : " & createdate & vbcrlf
FSO.Deletefile filename, True
end if
end if
end sub
====================================================================
copy above and save as Delete files based on created date.vbs file
===========================================================
BAT script file
cscript "Delete files based on created date.vbs" "C:\FTP" "*" "45"
save as FTP_Folder_Cleanup.bat BAT file
=====================================================
SYNC Script
rasdial XXX "username" "password"
net use S: "\\192.168.11.1\shared folders\Sync" /USER:Systemname\username "password"
cscript Copy_Data.vbs "XXX - Backup" "D:\Customer_Data\Backup" "S:\Customers\Backup from Hosted Server\XXX"
rasdial HCI /disconnect
save as Syncscript_to_BKPserver.bat
==========================================================
Alertmail.vbs
on error resume next
alertfor = wscript.arguments(0)
data = wscript.arguments(1)
runningon = wscript.arguments(2)
scheduledat = wscript.arguments(3)
startat= wscript.arguments(4)
endat = wscript.arguments(5)
status = wscript.arguments(6)
filearg = wscript.arguments(7)
dim log_description,logfile
if alertfor = "Websites Database Backup" then
fromname = "Websites DB Backup"
elseif alertfor = "India Onsite Backup - QCPre3" then
fromname = "Onsite Backup - India"
elseif alertfor = "US Onsite Backup" then
fromname = "Onsite Backup - US"
elseif alertfor = "IT Share Sync" then
fromname = "IT Share Sync"
else
fromname = "Sync Process"
end if
if instr(filearg,"/RLOG:") > 0 then
theleft = instr(filearg,"/RLOG:")
logfile = mid(filearg,theleft+6)
Read_Robocopy_logfile
elseif instr(filearg,"/XLOG:") > 0 then
theleft = instr(filearg,"/XLOG:")
logfile = mid(filearg,theleft+6)
Read_QXchange_logfile
elseif instr(filearg,"/DLOG:") > 0 then
theleft = instr(filearg,"/DLOG:")
logfile = mid(filearg,theleft+6)
Read_DTSpackage_logfile
end if
fromemailid = chr(34) & fromname & chr(34) &"it_support@cellarstone.com"
toemailid = "sajin_c@cellarstone.com"
'toemailid = "it_support@cellarstone.com"
'toemailid = "swaminathan_ramachandran@cellarstone.com"
'ccemailid = "swaminathan_ramachandran@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
subjectmsg = alertfor
'****************** Email format **********************
alertemail = "<html>" &_
"<head>" &_
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>" &_
"<title>IT Alerts</title>" &_
"<style type='text/css'>" &_
".style1 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;}" &_
".boldtext {font-family:Verdana, Arial, Helvetica, sans-serif;color: #FF0000; font-size:11px; font-weight:bolder;}" &_
".style2 {color: #FFFFFF;font-weight: bold;}" &_
".style3 {color: #FFFFFF;font-size: 12px;}" &_
".style4 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-weight:bold}" &_
".error-alert {color: #FF0000}" &_
"</style>" &_
"</head><body>" &_
"<table width='61%' border='1' cellpadding='0' cellspacing='1' bordercolor='#CCCCCC' class='style1'>" &_
"<tr><td height='30' colspan='4'><table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' class='style1'>" &_
"<tr bgcolor='#0086B3' class='style1'>" &_
"<td width='17%' class='style1'><span class='style2'>Alert For</span></td>" &_
"<td width='83%'><span class='style3'>" & alertfor & "</span></td></tr>" &_
"</table></td></tr>" &_
"<tr>" &_
"<td width='17%' height='20' bgcolor='#EEF3F9'>Data</td><td width='32%'>" & data & "</td>" &_
"<td width='17%' bgcolor='#EEF3F9'>Start Time </td><td width='34%'>" & startat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Running On </td><td>" & runningon & "</td>"&_
"<td bgcolor='#EEF3F9'>End Time </td><td>" & endat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Scheduled Time </td><td>" & scheduledat & "</td>" &_
"<td bgcolor='#EEF3F9'>Status</td><td>" & status & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4'> </td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4' bgcolor='#EEF3F9'>Log / Error Description</td>" &_
"</tr>" &_
"<tr valign='top'>" &_
"<td height='88' colspan='4'>" & log_description &"</td>" &_
"</tr>" &_
"</table>" &_
"</body>" &_
"</html>"
'********************* END ALERT EMAIL FORMAT **********************
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.CC = ccemailid
objEmail.Subject = subjectmsg
objEmail.HTMLbody = alertemail
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
'*****************PARSING ROBOCOPY LOG FILE*****************
sub Read_Robocopy_Logfile()
Dim arrFileLines()
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
if instr(arrFileLines(i),"Total") > 0 AND instr(arrFileLines(i),"Copied") > 0 Then
status = "Completed"
startline = i+1
else
startline = 0
end if
i = i + 1
Loop
objFile.Close
log_description = "emptyline--"
if startline = 0 then startline = i-9
For l = startline to i-1 step 1
log_description = log_description & "<BR>" & arrFileLines(l)
Next
log_description = replace(log_description,"emptyline--<BR>","")
log_description = "<pre>" & log_description & "</pre>"
End sub
'*****************PARSING QXCHANGE LOG FILE*****************
Sub Read_Qxchange_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Inserted Records </td><td>Error Records</td></tr>"
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load(logfile)
Set Log_Date = objXMLDoc.selectSingleNode("LogReport/Log/LogDate")
Set Log_Time = objXMLDoc.selectSingleNode("LogReport/Log/LogTime")
Set Total_Records = objXMLDoc.selectSingleNode("LogReport/Log/Total_Records")
Set Inserted_Records = objXMLDoc.selectSingleNode("LogReport/Log/Inserted_Records")
Set Error_Records = objXMLDoc.selectSingleNode("LogReport/Log/Error_Records")
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
totalrecords = split(Total_Records.Text, ",")
insertedrecords = split(Inserted_Records.Text, ",")
errorrecords = split(Error_Records.Text, ",")
for i=0 to Ubound(totalrecords) step 1
theright = instr(totalrecords(i)," - ")
tablename = left(totalrecords(i),theright)
totalrec = mid(totalrecords(i),theright+3)
insertedrec = mid(insertedrecords(i),theright+3)
errorrec = mid(errorrecords(i),theright+3)
if errorrec > 0 then errorrec = "<span class='error-alert'>"& errorrec &"</span>"
log_description = log_description & "<tr><td>"& tablename &"</td><td>"& totalrec &"</td><td>"& insertedrec & "</td><td>"& errorrec &"</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
'*****************PARSING DTS PACKAGE LOG FILE*****************
Sub Read_DTSpackage_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Status </td></tr>"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
strline = objFile.ReadLine
if instr(strline,"Step 'Copy Data from") > 0 Then
tablename = tablename & "," & mid(strline,instr(strline,"from ")+5,instr(strline," to [")-instr(strline,"from ")-5)
rec_status = rec_status & "," & mid(strline,instr(strline,"Step'")+6)
'log_description = log_description & tablename & " - " & rec_status & " - "
end if
if instr(strline,"Progress count in Step:") > 0 Then
'log_description = log_description & mid(strline,instr(strline,"Step:")+6) & vbcrlf
no_of_records = no_of_records & "," & mid(strline,instr(strline,"Step:")+6)
end if
Loop
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
tablename_list = split(tablename, ",")
no_of_records_list = split(no_of_records, ",")
rec_status_list = split(rec_status, ",")
for i=1 to Ubound(tablename_list) step 1
table_name = tablename_list(i)
record_count = no_of_records_list(i)
record_status = rec_status_list(i)
if record_status = "failed" then record_status = "<span class='error-alert'>"& record_status &"</span>"
log_description = log_description & "<tr><td>"& table_name &"</td><td>"& record_count &"</td><td>"& record_status & "</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
====================================================================
exclude_file.txt
D:\XXX\Sample\*.*
D:\ XXX \SQL Data\*.*
D:\ XXX \LogDir\*.*
D:\ XXX \LogDir\Log\*.*
D:\ XXX \AppDataDir\TempDir\*.*
D:\ XXX \Customer Data\*.*
D:\ XXX \AppDataDir\ArDir\*.*
==================================================================
copy_data.vbs
On Error Resume Next
Const ForReading = 1
error = 0
exiterror = 0
subjectmsg = ""
alertmsg = ""
strComputer = "."
subjectmsg1 = ""
desc=""
if wscript.arguments.count < 3 then
wscript.echo "Usage : Copy_Data.vbs <Description> <Source Path> <Destination Path>"
else
desc = wscript.arguments(0)
sourcepath = wscript.arguments(1)
destpath = wscript.arguments(2)
runningon = "-"
scheduledat = "Daily"
filename = "C:\scripts\Log\Backup-Robocopy_Log"
'ACCESS INFORMATION END
fromemailid = chr(34) & desc& " Backup" & chr(34) & "it_support@cellarstone.com"
toemailid = "sajin_c@cellarstone.com"
'toemailid = "it_support@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
sync_data = "robocopy " & chr(34) & sourcepath & chr(34) & " " & chr(34) & destpath & chr(34) & " /V /E /Z /R:10 /W:30 /Log:"
Start_Monitor_Syncprocess()
end if
Sub Start_Monitor_Syncprocess()
Set objShell = CreateObject("Wscript.Shell")
dim monthval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
min = Minute(Time)
if min<10 then min = "0" & min
sec = Second(Time)
if sec<10 then sec = "0" & sec
hr = Hour(Time)
if hr<10 then hr = "0" & hr
timeval = hr&min&sec
currenttime = dateval & "_" & timeval
logfile = filename & currenttime & ".txt"
startat = now()
objShell.Run sync_data&logfile,1,True
endat = now()
sendalertemail = " " & chr(34) & "India Onsite Backup - QCPre3" & chr(34) &" "& chr(34) & desc & chr(34) &_
" " & chr(34) & runningon & chr(34) & " " & chr(34) & scheduledat & chr(34) & " "& chr(34) & startat & chr(34) &_
" "& chr(34) & endat & chr(34) & " " & chr(34) & status & chr(34) & " " & chr(34) & "/RLOG:"& logfile & chr(34)
'wscript.echo sendalertemail
objShell.Run "wscript.exe alert_email.vbs" & sendalertemail ,1,True
end sub
sub sendalert(subjectmsg, alertmsg)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.cc = ccemailid
objEmail.Subject = subjectmsg &" - " & Now
objEmail.HTMLbody = alertmsg
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end sub
===============================================================
Hosted_CustomerData_XXX.vbs
'On Error Resume Next
Const ForReading = 1
error = 0
exiterror = 0
subjectmsg = ""
alertmsg = ""
strComputer = "."
subjectmsg1 = ""
destrootpath = "D:\Customer_Data\Backup\CRL"
destpath = "D:\Customer_Data\Backup\CRL"
exclude_list = "C:\scripts\exclude_files.txt"
dim monthval
dim dayval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
dayval = Array ("","Sun","Mon","Tue","Wed","Thu","Fri","Sat")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
bkpfolder = date1 & monthval(Month(Date)) & Year(Date)
Set objShell = CreateObject("Wscript.Shell")
'DISPLAY PROGRESS BAR
Set FSO = CreateObject("Scripting.FileSystemObject")
IF FSO.FolderExists("D:\CRL") then
sourcepath = "D:\CRL"
destpath = destpath & "\" & bkpfolder & "_QCommission"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
IF FSO.FolderExists("C:\home12") then
sourcepath = "C:\Users\Public\Documents\QCommission Pro"
destpath = destpath & "\" & bkpfolder & "_QCommission Pro"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
IF FSO.FolderExists("C:\home22") then
sourcepath = "C:\Users\Public\Documents\QCommission Premier"
destpath = destpath & "\" & bkpfolder & "_QCommission Premier"
compresstofile = "Rar.exe a -dh -ep2 -x@" & chr(34) & exclude_list & chr(34) & " "& chr(34) & destpath & ".rar" & chr(34) & " " & chr(34) & sourcepath & chr(34)
objShell.Run compresstofile,0,True
end if
'objExplorer.Document.Body.InnerHTML = "Your logoff script is now complete."
=======================================================================
SQL Script for backup save as CRL_BackupQuery.sql
BACKUP DATABASE [DBNAME] TO DISK = N'D:\Customer_Data\Backup\CRL\ DBNAME _05Jun2013.bak' WITH NOFORMAT, NOINIT, NAME = N' DBNAME -Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
EXIT
==================================================================
XXX_DB.vbs
atabase_server = "systemname/instance"
const dbname = "DBNAME"
const backup_folder = "D:\Customer_Data\Backup\XXX\"
const sqlfile_path = "C:\Scripts\XXX_BackupQuery.sql"
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
backup_filename = backup_folder & dbname & "_" & dateval & ".bak"
rar_filename = backup_folder & dbname & "_" & dateval & ".rar"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
'Set objCmd = objShell.Exec("sqlcmd -S " & database_server & " -Q " & chr(34) &"select name from sys.databases" &chr(34))
dbbackupscript = "BACKUP DATABASE [" & dbname & "] TO DISK = N'" & backup_filename & "' WITH NOFORMAT, NOINIT, NAME = N'" & dbname & "-Full Database Backup',"
dbbackupscript = dbbackupscript & " SKIP, NOREWIND, NOUNLOAD, STATS = 10" & vbCrLf & "GO" & vbCrLf & "EXIT"
Set objFile = objFSO.CreateTextFile(sqlfile_path, True)
objFile.WriteLine dbbackupscript
objFile.Close
Set objCmd = objShell.Exec("sqlcmd -S " & database_server & " -i " & sqlfile_path)
Do until objcmd.StdOut.AtEndOfStream
strout = objcmd.StdOut.ReadLine
loop
compresstofile = "rar.exe a -ep -df " & Chr(34) & rar_filename & Chr(34) & " " & Chr(34) & backup_filename & Chr(34)
if instr(strout,"BACKUP DATABASE successfully processed") > 0 then
Set objCmd = objShell.Exec(compresstofile)
end if
BACKUP DATABASE [DBNAME] TO DISK = N'D:\Customer_Data\Backup\CRL\ DBNAME _05Jun2013.bak' WITH NOFORMAT, NOINIT, NAME = N' DBNAME -Full Database Backup', SKIP, NOREWIND, NOUNLOAD, STATS = 10
GO
EXIT
==================================================================
XXX_DB.vbs
atabase_server = "systemname/instance"
const dbname = "DBNAME"
const backup_folder = "D:\Customer_Data\Backup\XXX\"
const sqlfile_path = "C:\Scripts\XXX_BackupQuery.sql"
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
backup_filename = backup_folder & dbname & "_" & dateval & ".bak"
rar_filename = backup_folder & dbname & "_" & dateval & ".rar"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
'Set objCmd = objShell.Exec("sqlcmd -S " & database_server & " -Q " & chr(34) &"select name from sys.databases" &chr(34))
dbbackupscript = "BACKUP DATABASE [" & dbname & "] TO DISK = N'" & backup_filename & "' WITH NOFORMAT, NOINIT, NAME = N'" & dbname & "-Full Database Backup',"
dbbackupscript = dbbackupscript & " SKIP, NOREWIND, NOUNLOAD, STATS = 10" & vbCrLf & "GO" & vbCrLf & "EXIT"
Set objFile = objFSO.CreateTextFile(sqlfile_path, True)
objFile.WriteLine dbbackupscript
objFile.Close
Set objCmd = objShell.Exec("sqlcmd -S " & database_server & " -i " & sqlfile_path)
Do until objcmd.StdOut.AtEndOfStream
strout = objcmd.StdOut.ReadLine
loop
compresstofile = "rar.exe a -ep -df " & Chr(34) & rar_filename & Chr(34) & " " & Chr(34) & backup_filename & Chr(34)
if instr(strout,"BACKUP DATABASE successfully processed") > 0 then
Set objCmd = objShell.Exec(compresstofile)
end if
=======================================================================
QCDBBackup.bat file to add in task
cscript XXX_DB.vbs
cscript Hosted_CustomerData_XXX.vbs
=======================================================================
Onsite Backup to NAS.bat Sync
net use U: \\10.199.4.XX\Backup /USER:admin Csiadmin
cscript copy_data.vbs "IT Division" "E:\IT_Division" "U:\IT_Division"
cscript copy_data.vbs "VS2005_BKP" "\\10.199.4.18\vs2005_bkp" "U:\VS2005_BKP"
cscript copy_data.vbs "VSS2005" "\\10.199.4.18\Products" "U:\VSS2005"
cscript copy_data.vbs "VSS" "\\10.199.4.13\Products" "U:\VSS"
cscript copy_data.vbs "E-Marketing" "E:\E-Marketing" "U:\E-Marketing"
cscript copy_data.vbs "Projects" "E:\Projects" "U:\Projects"
cscript copy_data.vbs "Implementation" "F:\Implementation" "U:\Implementation"
cscript copy_data.vbs "Sync" "S:\Sync" "U:\sync"
================================================================
copy_data.vbs
On Error Resume Next
Const ForReading = 1
error = 0
exiterror = 0
subjectmsg = ""
alertmsg = ""
strComputer = "."
subjectmsg1 = ""
desc=""
if wscript.arguments.count < 3 then
wscript.echo "Usage : Copy_Data.vbs <Description> <Source Path> <Destination Path>"
else
desc = wscript.arguments(0)
sourcepath = wscript.arguments(1)
destpath = wscript.arguments(2)
runningon = "CSINDIA_PDC"
scheduledat = "Daily"
filename = "D:\Logs\"&desc&"-Robocopy_Log-"
'ACCESS INFORMATION END
fromemailid = chr(34) & desc& " Backup" & chr(34) & "it_support@cellarstone.com"
toemailid = "it_support@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
sync_data = "robocopy " & chr(34) & sourcepath & chr(34) & " " & chr(34) & destpath & chr(34) & " /V /E /Z /R:10 /W:30 /Log:"
Start_Monitor_Syncprocess()
end if
Sub Start_Monitor_Syncprocess()
Set objShell = CreateObject("Wscript.Shell")
dim monthval
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date)) & Year(Date)
min = Minute(Time)
if min<10 then min = "0" & min
sec = Second(Time)
if sec<10 then sec = "0" & sec
hr = Hour(Time)
if hr<10 then hr = "0" & hr
timeval = hr&min&sec
currenttime = dateval & "_" & timeval
logfile = filename & currenttime & ".txt"
startat = now()
objShell.Run sync_data&logfile,1,True
endat = now()
sendalertemail = " " & chr(34) & "India Onsite Backup" & chr(34) &" "& chr(34) & desc & chr(34) &_
" " & chr(34) & runningon & chr(34) & " " & chr(34) & scheduledat & chr(34) & " "& chr(34) & startat & chr(34) &_
" "& chr(34) & endat & chr(34) & " " & chr(34) & status & chr(34) & " " & chr(34) & "/RLOG:"& logfile & chr(34)
'wscript.echo sendalertemail
objShell.Run "wscript.exe alert_email.vbs" & sendalertemail ,1,True
end sub
sub sendalert(subjectmsg, alertmsg)
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.cc = ccemailid
objEmail.Subject = subjectmsg &" - " & Now
objEmail.HTMLbody = alertmsg
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
end sub
=====================================================================
Alert_mail.vbs
on error resume next
alertfor = wscript.arguments(0)
data = wscript.arguments(1)
runningon = wscript.arguments(2)
scheduledat = wscript.arguments(3)
startat= wscript.arguments(4)
endat = wscript.arguments(5)
status = wscript.arguments(6)
filearg = wscript.arguments(7)
dim log_description,logfile
if alertfor = "Websites Database Backup" then
fromname = "Websites DB Backup"
elseif alertfor = "India Onsite Backup" then
fromname = "Onsite Backup - India"
elseif alertfor = "US Onsite Backup" then
fromname = "Onsite Backup - US"
elseif alertfor = "IT Share Sync" then
fromname = "IT Share Sync"
else
fromname = "Sync Process"
end if
if instr(filearg,"/RLOG:") > 0 then
theleft = instr(filearg,"/RLOG:")
logfile = mid(filearg,theleft+6)
Read_Robocopy_logfile
elseif instr(filearg,"/XLOG:") > 0 then
theleft = instr(filearg,"/XLOG:")
logfile = mid(filearg,theleft+6)
Read_QXchange_logfile
elseif instr(filearg,"/DLOG:") > 0 then
theleft = instr(filearg,"/DLOG:")
logfile = mid(filearg,theleft+6)
Read_DTSpackage_logfile
end if
fromemailid = chr(34) & fromname & chr(34) &"it_support@cellarstone.com"
toemailid = "it_support@cellarstone.com"
'toemailid = "swaminathan_ramachandran@cellarstone.com"
'ccemailid = "swaminathan_ramachandran@cellarstone.com"
smtpsvr = "mail.cellarstone.com"
subjectmsg = alertfor
'****************** Email format **********************
alertemail = "<html>" &_
"<head>" &_
"<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>" &_
"<title>IT Alerts</title>" &_
"<style type='text/css'>" &_
".style1 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 11px;}" &_
".boldtext {font-family:Verdana, Arial, Helvetica, sans-serif;color: #FF0000; font-size:11px; font-weight:bolder;}" &_
".style2 {color: #FFFFFF;font-weight: bold;}" &_
".style3 {color: #FFFFFF;font-size: 12px;}" &_
".style4 {font-family: Verdana, Arial, Helvetica, sans-serif;font-size: 10px; font-weight:bold}" &_
".error-alert {color: #FF0000}" &_
"</style>" &_
"</head><body>" &_
"<table width='61%' border='1' cellpadding='0' cellspacing='1' bordercolor='#CCCCCC' class='style1'>" &_
"<tr><td height='30' colspan='4'><table width='100%' height='100%' border='1' cellpadding='0' cellspacing='0' class='style1'>" &_
"<tr bgcolor='#0086B3' class='style1'>" &_
"<td width='17%' class='style1'><span class='style2'>Alert For</span></td>" &_
"<td width='83%'><span class='style3'>" & alertfor & "</span></td></tr>" &_
"</table></td></tr>" &_
"<tr>" &_
"<td width='17%' height='20' bgcolor='#EEF3F9'>Data</td><td width='32%'>" & data & "</td>" &_
"<td width='17%' bgcolor='#EEF3F9'>Start Time </td><td width='34%'>" & startat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Running On </td><td>" & runningon & "</td>"&_
"<td bgcolor='#EEF3F9'>End Time </td><td>" & endat & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td height='20' bgcolor='#EEF3F9'>Scheduled Time </td><td>" & scheduledat & "</td>" &_
"<td bgcolor='#EEF3F9'>Status</td><td>" & status & "</td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4'> </td>" &_
"</tr>" &_
"<tr>" &_
"<td colspan='4' bgcolor='#EEF3F9'>Log / Error Description</td>" &_
"</tr>" &_
"<tr valign='top'>" &_
"<td height='88' colspan='4'>" & log_description &"</td>" &_
"</tr>" &_
"</table>" &_
"</body>" &_
"</html>"
'********************* END ALERT EMAIL FORMAT **********************
Set objEmail = CreateObject("CDO.Message")
objEmail.From = fromemailid
objEmail.To = toemailid
'objEmail.CC = ccemailid
objEmail.Subject = subjectmsg
objEmail.HTMLbody = alertemail
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserver") = smtpsvr
objEmail.Configuration.Fields.Item ("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 25
objEmail.Configuration.Fields.Update
objEmail.Send
'*****************PARSING ROBOCOPY LOG FILE*****************
sub Read_Robocopy_Logfile()
Dim arrFileLines()
i = 0
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
Redim Preserve arrFileLines(i)
arrFileLines(i) = objFile.ReadLine
if instr(arrFileLines(i),"Total") > 0 AND instr(arrFileLines(i),"Copied") > 0 Then
status = "Completed"
startline = i+1
else
startline = 0
end if
i = i + 1
Loop
objFile.Close
log_description = "emptyline--"
if startline = 0 then startline = i-9
For l = startline to i-1 step 1
log_description = log_description & "<BR>" & arrFileLines(l)
Next
log_description = replace(log_description,"emptyline--<BR>","")
log_description = "<pre>" & log_description & "</pre>"
End sub
'*****************PARSING QXCHANGE LOG FILE*****************
Sub Read_Qxchange_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Inserted Records </td><td>Error Records</td></tr>"
Set objXMLDoc = CreateObject("Microsoft.XMLDOM")
objXMLDoc.async = False
objXMLDoc.load(logfile)
Set Log_Date = objXMLDoc.selectSingleNode("LogReport/Log/LogDate")
Set Log_Time = objXMLDoc.selectSingleNode("LogReport/Log/LogTime")
Set Total_Records = objXMLDoc.selectSingleNode("LogReport/Log/Total_Records")
Set Inserted_Records = objXMLDoc.selectSingleNode("LogReport/Log/Inserted_Records")
Set Error_Records = objXMLDoc.selectSingleNode("LogReport/Log/Error_Records")
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
totalrecords = split(Total_Records.Text, ",")
insertedrecords = split(Inserted_Records.Text, ",")
errorrecords = split(Error_Records.Text, ",")
for i=0 to Ubound(totalrecords) step 1
theright = instr(totalrecords(i)," - ")
tablename = left(totalrecords(i),theright)
totalrec = mid(totalrecords(i),theright+3)
insertedrec = mid(insertedrecords(i),theright+3)
errorrec = mid(errorrecords(i),theright+3)
if errorrec > 0 then errorrec = "<span class='error-alert'>"& errorrec &"</span>"
log_description = log_description & "<tr><td>"& tablename &"</td><td>"& totalrec &"</td><td>"& insertedrec & "</td><td>"& errorrec &"</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
'*****************PARSING DTS PACKAGE LOG FILE*****************
Sub Read_DTSpackage_logfile()
log_description = "<table width='575' border='1' cellpadding='0' cellspacing='1' bordercolor='#FFFFFF' class='style1'>" &_
"<tr bgcolor='#F4F8FB' class='style4'><td>Tables</td><td>Total Records</td><td>Status </td></tr>"
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFile = objFSO.OpenTextFile(logfile, 1)
Do Until objFile.AtEndOfStream
strline = objFile.ReadLine
if instr(strline,"Step 'Copy Data from") > 0 Then
tablename = tablename & "," & mid(strline,instr(strline,"from ")+5,instr(strline," to [")-instr(strline,"from ")-5)
rec_status = rec_status & "," & mid(strline,instr(strline,"Step'")+6)
'log_description = log_description & tablename & " - " & rec_status & " - "
end if
if instr(strline,"Progress count in Step:") > 0 Then
'log_description = log_description & mid(strline,instr(strline,"Step:")+6) & vbcrlf
no_of_records = no_of_records & "," & mid(strline,instr(strline,"Step:")+6)
end if
Loop
'log_description = "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
'log_description = log_description & "Date Time: " & Log_Date.Text & " " & Log_Time.Text & "<BR>"
'log_description = log_description & "Total Records: " & Total_Records.Text & "<BR>"
'log_description = log_description & "Inserted_Records: " & Inserted_Records.Text & "<BR> <BR>"
'log_description = log_description & "Error Records: " & Error_Records.text & "<BR>"
'log_description = log_description & "-----------------------------------------------------------------------------------------------------------------------------------------------<BR>"
tablename_list = split(tablename, ",")
no_of_records_list = split(no_of_records, ",")
rec_status_list = split(rec_status, ",")
for i=1 to Ubound(tablename_list) step 1
table_name = tablename_list(i)
record_count = no_of_records_list(i)
record_status = rec_status_list(i)
if record_status = "failed" then record_status = "<span class='error-alert'>"& record_status &"</span>"
log_description = log_description & "<tr><td>"& table_name &"</td><td>"& record_count &"</td><td>"& record_status & "</td></tr>"
next
status = "Completed"
log_description = log_description &"</table>"
end sub
=====================================================================
EC_BKP_TO_LOCAL.vbs
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objShell = CreateObject("Wscript.Shell")
const ftp_backupfolder = "DB_Backup"
const local_backupfolder = "W:\Easy"
Const FTPServer = "app.easy-.com"
Const FTPServerUser = "ECommission"
Const FTPServerPwd = "Ecom2rdp0905"
emaillog = "File download from Easy-.com to Local server: <BR> Start Time:" & Now() & "<BR>"
monthval = Array ("","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")
date1 = day(Date)
if date1 < 10 then date1 = "0" & date1
bkpdateval = date1 & monthval(Month(Date)) & Year(Date)
date1 = day(Date - 1)
if date1 < 10 then date1 = "0" & date1
dateval = date1 & monthval(Month(Date - 1)) & Year(Date - 1)
backuplog = backuplog_folder & bkpdateval & ".log"
rar_filename = dateval & ".rar"
Set logFile = objFSO.CreateTextFile(backuplog, true)
'******************FILE DOWNLOAD FROM Easy-.COM TO LOCAL PROJECTS SHARE - START*********************
logfile.writeline Now() & ": File download from Easy-.com - START"
Set objFile = objFSO.CreateTextFile("C:\Scripts\ftpcmd.dat", true)
objFile.WriteLine "User " & FTPServerUser
objFile.WriteLine FTPServerPwd
objFile.WriteLine "bin"
objFile.WriteLine "cd " & ftp_backupfolder
objFile.WriteLine "lcd " & chr(34) & local_backupfolder & chr(34)
objFile.WriteLine "mget *" & rar_filename
objFile.WriteLine "quit"
objFile.Close
Set objCmd = objShell.Exec("ftp -n -d -i -s:ftpcmd.dat " & FTPserver)
Do until objcmd.StdOut.AtEndOfStream
logfile.writeline objcmd.StdOut.ReadLine
loop
logfile.writeline Now() & ": File download from Easy-.com - END"
'******************FILE DOWNLOAD FROM Easy-.COM TO LOCAL PROJECTS SHARE - END***********************
====================================================================
ftpcmd.dat
User Username
Password
bin
cd DB_Backup
lcd "W:\Easy"
mget *29Aug2013.rar
quit
========================================================================
shutdownguoard
=================================================
To enable Backup
Cobian Backup 11 (Gravity)
Version 11, Gravity
For Windows XP, 2003, Vista, 2008, Windows 7
Works in both 32 and 64 bits Windows
Latest version: 11.2.0.582
Version 11, Gravity
For Windows XP, 2003, Vista, 2008, Windows 7
Works in both 32 and 64 bits Windows
Latest version: 11.2.0.582
==========================================================
How to change the Remote Desktop Listening Port
==============================================================================