Update: 2024-03-29 – I was looking at this blog post and noticed the PowerShell script had been mangled when I changed my code block plugin. I believe I’ve corrected the issues but if you run into problems executing the script look for HTML tags like <
and replace them with the proper character which would be <
in that examples case.
We’re running Patterson EagleSoft v18.10.05 on a Windows 2008 R2 Standard server.
We have auto-backup configured to run when ever the database starts up and to keep 14 backups:
We have a scheduled task on the server that runs “D:\EagleSoft\Shared Files\techaid.exe -stop” at 3:00am and then “D:\EagleSoft\Shared Files\techaid.exe -start” at 3:15am to trigger a nightly automatic backup while the database isn’t in use.
We just noticed that backups haven’t been occurring since 2017-12-31. Funny how they stopped 2018-01-01.
Then around 2018-02-12 the EagleSoft database would stop as planned at 3:00am and then crash/fail to start at 3:15am with no backup being generated. We’d then have to manually start EagleSoft’s database the next day so users could access it.
We found files like these in the EagleSoft auto backup directory:
- DotNetZip-5tusrxsj.tmp
- DotNetZip-fybwnf0z.tmp
- DotNetZip-hete0py2.tmp
- DotNetZip-zjlqhwj0.tmp
After contacting Patterson for support they informed us this is a known issue with EagleSoft v18 and the fix was to upgrade to v19.
I dug into the backup zip files and found they contain only three files:
- Eaglesoft.Server.Configuration.data
- PattersonPM.db
- PattersonPM.log
All of which are located in “<EAGLESOFT INSTALL DIR>\Data”.
Some further digging showed there were additional LOG and DB files in the Data DIR that aren’t being backed up by auto backup.
Upgrading right now isn’t exactly an option for us so I wrote a PowerShell script to replace EagleSofts built-in auto backup. We run full backups of the server with Veeam so this script is just a little extra insurance for the database specifically.
Note: This script requires PowerShell v5.0 or newer. As of this writing v5.1 appears to be the newest and can be installed on Windows Server 2008 R2 or newer.
# # Written by: Eric Schewe ([email protected]) # Created on: 2018-02-19 # # This script replaces the auto backup feature built into EagleSoft which appears to have broken as of 2018-01-01 in v18. # Patterson recommends upgrading to v19 to resolve the issue. In the mean time this script can replace the auto backup. # # This script will stop the EagleSoft database, copy the database files, start EagleSoft and the compress the database copies. # # This script requires PowerShell v5.0 or newer # # Important: Make sure auto backup is disabled or EagleSoft may not start up properly after this script runs # # Installation: # 1. Configure this as a scheduled task that runs on your server when no one is using EagleSoft # 2. Set $eagleSoftDirectory and $backupsLocation # 3. Set $backupsToKeep to how many days of backups you want to keep # # <-------- Start User Configuration --------> # Where is EagleSoft installed? # Example: "C:\EagleSoft" $eagleSoftDirectory = "C:\EagleSoft" # Where do you want the backups to go? # Example: "D:\EagleSoft-Backups" $backupsLocation = "D:\EagleSoft-Backups" # How many days of backups do you want to keep? $backupsToKeep = 14 # <-------- End User Configuration --------> $goToRunBackups = $true; # Initialize variable $date = (Get-Date -Format yyyy-MM-dd) # Todays date $dateTime = (Get-Date -Format yyyyMMdd-HHmmss) # Right now # Make sure the backup location exists if(!(Test-Path -Path $backupsLocation )){ Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Error: Backup destination directory does not exist or cannot be accessed" $goToRunBackups = $false; } # Make sure the EagleSoft installation dir is set correctly if(!(Test-Path -Path "$($eagleSoftDirectory)\Shared Files\techaid.exe" )){ Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Error: Cannot find techaid.exe. Make sure EagleSoft installation directory is correct" $goToRunBackups = $false; } if ($goToRunBackups -eq $true) { # Setup some variables $scratchDir = "$($backupsLocation)\scratchDir-$($dateTime)" $backupFilename = "EagleSoft-Backup-$($dateTime).zip" $databasesToBackup = (Get-Item -Path "$($eagleSoftDirectory)\Data\*.db") # Create a scratch directory for us to use Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Creating scratch directory" New-Item -Force -ItemType directory -Path $scratchDir | Out-Null # Stop the EagleSoft database Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Stopping EagleSoft" & "$($eagleSoftDirectory)\Shared Files\techaid.exe" -stop Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Waiting 60 seconds for everything to stop" Start-Sleep 60 Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Copying database and log files" foreach ($database in $databasesToBackup) { Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Copying $($database.Name)" Copy-Item -path "$($eagleSoftDirectory)\Data\$($database.Name)" -destination $scratchDir # Check if a matching log file exists and grab it to $logFile = $($database.Name) -replace ".db", ".log" if(Test-Path -Path "$($eagleSoftDirectory)\Data\$logFile"){ Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Copying $logFile" Copy-Item -path "$($eagleSoftDirectory)\Data\$logFile" -destination $scratchDir } } # Backup configuration file Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Copying configuration file" Copy-Item -path "$($eagleSoftDirectory)\Data\Eaglesoft.Server.Configuration.data" -destination $scratchDir # Start the EagleSoft database Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Starting EagleSoft" & "$($eagleSoftDirectory)\Shared Files\techaid.exe" -start # Compress the backed up files Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Compressing files" Compress-Archive -Path $scratchDir -DestinationPath "$($backupsLocation)\$($backupFilename)" # Clean-up scratch directory Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Removing scratch directory and files" Remove-Item -path $scratchDir -recurse -force # Clean-up old backups Write-Host "$(Get-Date -Format "yyyy-MM-dd HH:mm:ss") - Purging old backups" Get-ChildItem $backupsLocation | Where-Object { $_.LastWriteTime -lt $(Get-Date).AddDays("-$($backupsToKeep)") } | Remove-Item }
You can save this as ‘eagleSoftBackups.ps1‘ (or anything really) on your EagleSoft server and then use ‘Scheduled Tasks’ to schedule it to run nightly or how ever often you want.
Thanks for your posting and powershellscript! Just ran into this exact error after enabling auto backups on a new server.
-Scott
Happy to hear it was useful for someone!