Let me preface this by saying that my knowledge of scripting is minimal and any script I develop usually ends up looking like a hack job
I am looking to piece together a script where:
Backup job at Site A starts
executes a script that will check a replication job at Site B to ensure it is not currently running.
It will then keep the backup job at Site A from executing until the replication job has finished.
I understand this will require some sort of invoke command
Invoke-Command -comp RepositoryFQDN -scriptblock {ScriptBlock} , as well as some sort of do while or do until loop that continues to check the status
( $Job = Get-VBRJob -name "Name of replication Job"
$Job.GetLastState() -eq "Working" ) of the remote job say every 60 minutes and once it sees the status as not working, then will allow the current job to proceed.
This will allow me to avoid the situation where a replication job may run several hours past the expected time. This only really occurs though on our 2 file servers that have Windows 2012 enabled which will, in turn, kick off a larger than normal incremental replication job occasionally based no the Windows 2012 deduplication/garbage collection/scrubbing process.
Thanks!
-
- Enthusiast
- Posts: 25
- Liked: 3 times
- Joined: Mar 12, 2012 3:10 am
- Full Name: Jay
- Location: Cincinnati, OH
- Contact:
-
- Product Manager
- Posts: 20406
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to Check Working status at remote site
The following example should shed some light on how to check a job state and execute a second one in accordance:
Thanks.
Code: Select all
$Job = Get-VBRJob -name "Name of replication Job"
do{
Start-sleep -s 60
}while ($Job.GetLastState() -eq "Working")
Get-VBRJob -name "Name of second Job" | Start-VBRJob
-
- Enthusiast
- Posts: 25
- Liked: 3 times
- Joined: Mar 12, 2012 3:10 am
- Full Name: Jay
- Location: Cincinnati, OH
- Contact:
Re: Script to Check Working status at remote site
I haven't had much time to test this, however, how would the call be handled when checking on remote servers? For example: Server A has backup job C that may run for an extended period of time. Server B has replication job D that shouldn't start until Backup job C on Server A is completed.
Again, excuse my ignorance on scripting.
Thanks
Again, excuse my ignorance on scripting.
Thanks
-
- Product Manager
- Posts: 20406
- Liked: 2298 times
- Joined: Oct 26, 2012 3:28 pm
- Full Name: Vladimir Eremin
- Contact:
Re: Script to Check Working status at remote site
The best idea would be set a script as post activity for backup job C. Once the backup job C is finished, post-job activity will be started. Within the script connection to site B will be setup, and replication job D will be executed. Thanks.
Who is online
Users browsing this forum: No registered users and 12 guests