The Backup Scripts feature is an awesome one and can be very useful for situations when a task needs to be run before, after, or in the event of a failure of a backup. Below I will include some information about this feature, how it can be used, etc. I hope this proves to be helpful.
What can be executed through the Backup Scripts feature?
- Any type of file that can be executed by an operating system
What types of scripts/languages can be used for the Backup Scripts feature?
- If the operating system can execute the file type, then it can be used as a Backup Script.
- Example: on a Windows server, you could easily use .bat, .vbs, .ps1, or even an .exe
How should the file be referenced in the Jungle Disk Configuration Manager?
- Absolute paths must be used
- This Example Fails: junglediskbackupscript.ps1
- This Example Works: C:\Users\username\Documents\junglediskbackupscript.ps1
As for being able to specify arguments to an executable, I do not believe this is possible, but will have to test it out, Judging by what I am seeing in the code, this is not supported, but you could always have a script that executes an .exe and can pass in arguments.
Here's an example script I wrote up for another customer. This vbs script will fire off an email when the Backup Vault Database reaches a certain size, but will only fire the email when the size is exceeded, not before.
Dim maxFileSize
Dim OutputStr
Dim sendFrom
Dim sendTo
Dim sendSMTP
Dim sendUser
Dim sendPass
Dim sendPort
Dim useSSL
'***********************************
' VARIABLES
' Change these variables to fit your location
'
maxFileSize=14 'Maximum allowed DB file size in GB
sendFrom="""Jungle Disk Backup Script Notifier"" //YOUREMAIL@HERE//" 'The FROM name and email that displays on the email (extra quotes are needed)
sendTo="//RECIPIENTEMAIL@HERE//" 'The email address to send emails to
sendSMTP="//SERVER NAME HERE//" 'SMTP server to send emails
sendUser="//SMTP USERNAME HERE//" 'Username for SMTP server to send emails
sendPass="//SMTP USER PASSWORD HERE//" 'Password for SMTP server to send emails
sendPort=465 'Port number for SMTP server to send emails
useSSL=true 'Does the sending SMTP server use SSL? true or false
'
'***********************************
Set WshShell = Wscript.CreateObject("WScript.Shell")
Set Envi = WshShell.Environment ("Process")
Set objFSO = createobject("Scripting.FileSystemObject")
Set shApp = CreateObject("Shell.application")
'Check to see if the local\app data directory exists
If objFSO.FolderExists("C:\PATH\\TO\\FOLDER\\HERE") Then
Set FolderPath = objFSO.GetFolder("C:\PATH\\TO\\FOLDER\\HERE")
'For each file that ends in "db", check it's file size
For Each File in FolderPath.Files
If objFSO.GetExtensionName(File)="db" Then
'1843 is the size of the file in MB
If cint((File.size / 1024) / 1024) > maxFileSize Then
OutputStr = OutputStr & File.name & " : " & cint((File.Size / 1024) / 1024) & "MB" & vbCrLf
End If
End If
Next
'If there was output, email the information
If OutputStr <> "" Then
Set WshNetwork = WScript.CreateObject("WScript.Network")
Const cdoBasic = 1 'basic (clear-text) authentication
Set objMessage = CreateObject("CDO.Message")
objMessage.Subject = "The backup database files on " & WshNetwork.ComputerName & " are too large."
objMessage.From = sendFrom
objMessage.To = sendTo
objMessage.TextBody = OutputStr
'This section provides the configuration information for the remote SMTP server.
With objMessage.Configuration.Fields
.Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = sendSMTP
'Type of authentication, NONE, Basic (Base64 encoded), NTLM
.Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic
.Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sendUser
.Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sendPass
.Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = sendPort
.Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = useSSL
.Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 60
.Update
End With
On Error Resume Next
objMessage.Send
End If
Else
wscript.echo "Error: Folder path does not exist."
End If