Step 1: Create a Postgres ODBC DSN called '3DRepo' pointing to your 3D repository. Save the credentials in the ODBC DSN.
Step 2: Create a Host Script in RED / PowerShell 64 type and add the code below:
(This script is used to remove all locks from the repository. A back-up is only possible when all the objects are unlocked.)
$conn = new-object System.Data.Odbc.OdbcConnection $conn.connectionstring = "DSN=3DRepo;" $sqlCommand="DELETE FROM wsmeta.wb_obj_lock" $cmd = New-object System.Data.Odbc.OdbcCommand($sqlCommand,$conn) try { $conn.Open(); $status=$cmd.ExecuteNonQuery() Write-Host 1 $conn.Dispose() Write-Host "Unlock executed successfully!" } catch { 3 Write-Host $_.Exception.Message }
Step 3: Create another Host Script RED / PowerShell 64 type and add the code below:
(This script sets paths and variables and then uses 3D CLI to execute the back-up. You will need to edit the variables based on your environment)
$repo = "Demo" $3DPath = "C:\Program Files\WhereScape\WhereScape 3D\" $JavaPath = "C:\Program Files\WhereScape\WhereScape 3D\jre\bin\java" $3DjarPath = "C:\Program Files\WhereScape\WhereScape 3D\WhereScape- 3D-HEAD-bundle.jar" $DateFormat = Get-Date -Format "yyyy.MM.dd_HH.mm.ss" $BKP_Dir = "C:\Temp\" $BKP_Name = "$($DateFormat)_$($repo)" Set-Location -Path "$3DPath"; Invoke-Expression '& $JavaPath -Xmx512m -XX:MaxMetaspaceSize=512m - splash: -jar $3DjarPath backuprepo -repo $repo -o "$($BKP_Dir)$($BKP_Name)" -f' 1
Step 4: Execute the first script and check if the objects are unlocked.
Step 5: Execute the second script and check if the back-up file is created in the specified location.
Step 6: Create a new Job in RED containing both scripts and schedule the Job.
Limitations: The WhereScape RED scheduler must be run under a specified domain user. Using a System Account will not work.