Post new topic Reply to topic  [ 1 post ] 
Author Message
 Post subject: backup autorotate - stable and tested
PostPosted: 2010-06-26 07:33 
Normal user

Joined: 2008-05-25 11:15
Posts: 97
Put the script inside a .vbs file
change the "changeme" parts as for your system (backup path to watch in, admin password)
check hmailserver console for backup path existing from backup function
schedule this vbs on host task schedule manager
et voilĂ  !

works in 4.x and 5.x


Code:
Dim Fso

Dim Directory

Dim Modified

Dim Files

' search for backupfiles older than days
' delete them
' fires a new backup

' change me !
Const sAdminPassword = "<hmailadmin_password_put_here>"

strLogFIleSuffix   = ".zip"

' change me !
strPath = "C:\the_path_for_backup_destination"

' days old to retain zips
intDaysOld         = 3

Set Fso = CreateObject("Scripting.FileSystemObject")

Set Directory = Fso.GetFolder(strPath)


Set Files = Directory.Files

For Each Modified in Files

If DateDiff("D", Modified.DateLastModified, Now) > intDaysOld  and lcase(right(Modified,4))=strLogFIleSuffix  Then
   Modified.Delete
   ' just debug purpouse
   ' WScript.Echo("    Will delete " & Modified.Name)
end if

Next

' This scripts creates a hMailServer backup using the settings
' specified in hMailAdmin. You can double-click on the file to
' run the script.
'
' To use the script you need to update the sAdminPassword
' setting below to reflect your own hMailServer Administrator
' password. If you want to run automatic backups, please
' start this script using Windows Scheduled Tasks.
'


Dim oApp
Set oApp = CreateObject("hMailServer.Application")
' Authenticate the client.
Call oApp.Authenticate ("Administrator", sAdminPassword)

Call oApp.BackupManager.StartBackup()


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 


Who is online

Users browsing this forum: No registered users and 1 guest



Search for:
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group