Skip to content

Instantly share code, notes, and snippets.

@peisenhower
Last active August 20, 2018 19:36
Show Gist options
  • Save peisenhower/c9c6c46b5ab6e82793e3ef6859be338a to your computer and use it in GitHub Desktop.
Save peisenhower/c9c6c46b5ab6e82793e3ef6859be338a to your computer and use it in GitHub Desktop.
Script to backup nexus server, programatically re-index and offload backup to s3 bucket
@ECHO ON
SET OUT_PATH=C:\nexus-backup\nexus_backup_%date:~4,2%%date:~7,2%%date:~10,4%.zip
SET NEXUS_BACKUP="C:\Program Files (x86)\Altium\Altium NEXUS Server\Tools\BackupTool\avbackup.exe"
@rem Backing up nexus server
%NEXUS_BACKUP% backup -z %OUT_PATH%
@rem Backup Complete
SLEEP 300
@rem Forcing Re-Index
Get-ChildItem IIS:\AppPools | where {$_.state -eq "Started"} | Stop-WebAppPool
SLEEP 10
rm C:\ProgramData\Altium\NexusServerData\SearchData\*
Get-ChildItem IIS:\AppPools | where {$_.state -eq "Stopped"} | Start-WebAppPool
@rem Re-Index Starting
set AWS_ACCESS_KEY_ID=xxxxxxxxxxxxxxx
set AWS_SECRET_ACCESS_KEY=xxxxxxxxxxxxxxxxxxx
set AWS_DEFAULT_REGION=us-east-1
@rem offload backup
aws s3 cp %OUT_PATH% s3://altium-nexus-backup/nexus_backup_%date:~4,2%%date:~7,2%%date:~10,4%.zip
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment