Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.
One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.
Shared tmr As New System.Timers.Timer(10000) Shared blnCopyInProgress As Boolean = False Protected Overrides Sub OnStart(ByVal args() As String) tmr.Enabled = True AddHandler tmr.Elapsed, AddressOf tmr_Tick tmr.Start() End Sub Protected Overrides Sub OnStop() SendMail("Service has stopped.") tmr = Nothing End Sub Shared Sub tmr_Tick(ByVal source As Object, ByVal e As Timers.ElapsedEventArgs) If blnCopyInProgress Then Exit Sub If tmr.Interval <> 600000 Then tmr.Interval = 600000 'set timer to test every 10 minutes (going forward) If Today.DayOfWeek = DayOfWeek.Saturday Or Today.DayOfWeek = DayOfWeek.Sunday Then Exit Sub 'Don't run on the weekends fileDate = Today.Year & Today.Date.ToShortDateString.Substring(0, 2) & Today.Date.ToShortDateString.Substring(3, 2) strSrcFile = strSource & fileDate & fileName.Replace(".MDB", ".zip") If File.Exists(strSrcFile) Then CopyData() End Sub 'Here's the 2 variations of CopyData - this first one will run - but all it does is send an email alert. The second one 'won't run 'at all' - I get no email alert, even though that's all it's doing before it exits the sub. What could be wrong here? Shared Sub CopyData() SendMail("made it this far") End Sub ' or... Shared Sub CopyData() SendMail("made it this far") Exit Sub blnCopyInProgress = True Dim sc As Shell32.ShellClass = New Shell32.ShellClass Dim sf As Shell32.Folder = sc.NameSpace(strSrcFile) Dim df As Shell32.Folder = sc.NameSpace(strTarget) Dim fi As Shell32.FolderItems = sf.Items Dim strTgtFile As String = strTarget & fileDate & fileName.Replace("MDB", "ZIP") Try df.CopyHere(fi) If File.Exists(strTarget & fileName) Then File.Delete(strTarget & fileName) File.Move(strSrcFile.Replace(strSource, strTarget), strTarget & fileName) WriteEvent("Sleeping for 20 hours") System.Threading.Thread.Sleep(72000000) Catch WriteEvent("Failed to extract audit data.", EventLogEntryType.Error) End Try fi = Nothing df = Nothing sf = Nothing sc = Nothing blnCopyInProgress = False End Sub
Join the community of 500,000 technology professionals and ask your questions.