Reboot Top of the Hour
I have my "server" database reboot once per hour. I work from home, so I like to hear the sound (I use a Star Trek transporter sound, which I'm sure many of you have heard in the background of some of my videos. I like it. Too bad.) It comforts me to know that everything is running smoothly and the database is rebooting when it should.
Recently, I decided that I'd like it to reboot at the top of the hour. So my database is now kinda like a cuckoo clock. If you'd like to do the same, just insert the following red lines of code into the CheckForReboot sub:
Private Sub CheckForReboot()
Dim LastRebootTime As Date
Dim ExpectedRebootTime As Date
Dim RebootMinutes As Long
If Abort Then Exit Sub
If IsNull(LastReboot) Or LastReboot = "" Then LastReboot = #1/1/1990#
If IsNull(RebootXMin) Or RebootXMin = "" Then RebootXMin = 0
If RebootXMin = 0 Then Exit Sub
LastRebootTime = CDate(LastReboot)
RebootMinutes = CLng(RebootXMin)
ExpectedRebootTime = DateAdd("n", RebootMinutes, LastRebootTime)
' Add this to force your system to reboot at the top of the hour
' I recommend only doing this if your reboot interval is a MINIMUM of one hour
Dim NextHour As Long
NextHour = Hour(ExpectedRebootTime)
ExpectedRebootTime = DateSerial(Year(ExpectedRebootTime), Month(ExpectedRebootTime), _
Day(ExpectedRebootTime)) + TimeSerial(NextHour, 0, 0)
If ExpectedRebootTime < Now() Then
RebootOnly
Else
Status "Reboot at " & ExpectedRebootTime
SleepSec 2
End If
End Sub
That's it. Now your system will reboot at the top of the next hour. I'll incorporate this into the AccessUpdater master copy the next time I edit it. For now, you've got to do the grunt work yourself. Suck it up. :) jk