-
- Novice
- Posts: 5
- Liked: 1 time
- Joined: Jan 01, 2006 1:01 am
- Contact:
Script to start all backup jobs and then wait
Hi there,
I have a requirement to run several Veeam backup jobs and then backup to tape.
At the moment my powershell script runs each Veeam backup job one after the other and then starts a backup exec job to backup the Veeam backup files to tape.
Is it possible to script a mechanism in which all Veeam jobs could be started in parallel and then run the backup exec job only after the last Veeam job completes?
I have a requirement to run several Veeam backup jobs and then backup to tape.
At the moment my powershell script runs each Veeam backup job one after the other and then starts a backup exec job to backup the Veeam backup files to tape.
Is it possible to script a mechanism in which all Veeam jobs could be started in parallel and then run the backup exec job only after the last Veeam job completes?
-
- Influencer
- Posts: 16
- Liked: never
- Joined: May 29, 2011 1:55 am
- Contact:
Re: Script to start all backup jobs and then wait
Possible? Yes. Recommended? no.
I wouldn't run all the jobs at once unless you have a very distributed load--multiple proxies/storage locations/hosts.
It would take some coding though. You could check the SQL DB for any entries in Backup.TrackedActions.Locks or for a change in the job status (I forget which table that is in). Set that check for a loop that exits when the check fails and then run the BackupExec tape job.
I wouldn't run all the jobs at once unless you have a very distributed load--multiple proxies/storage locations/hosts.
It would take some coding though. You could check the SQL DB for any entries in Backup.TrackedActions.Locks or for a change in the job status (I forget which table that is in). Set that check for a loop that exits when the check fails and then run the BackupExec tape job.
-
- Veteran
- Posts: 282
- Liked: 26 times
- Joined: Nov 10, 2010 6:51 pm
- Full Name: Seth Bartlett
- Contact:
Re: Script to start all backup jobs and then wait
This should work for what you need, this will do ALL the jobs, if you need to JUST do backup jobs, let me know.
Code: Select all
Get-VBRJob | Start-VBRJob -RunAsync
$JobList = New-Object System.Collections.ArrayList
foreach($Job in (Get-VBRJob))
{
$JobList.Add($Job)
}
while($JobList.Count -ne 0)
{
foreach($Job in $JobList)
{
if($Job.IsStopped() -eq $true)
{
$JobList.Remove($Job)
}
}
}
Run your BackupExec here.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
-
- Veteran
- Posts: 282
- Liked: 26 times
- Joined: Nov 10, 2010 6:51 pm
- Full Name: Seth Bartlett
- Contact:
Re: Script to start all backup jobs and then wait
You will want to add a pause/sleep 10 or so after the if statement, I forgot that!
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
-
- Veteran
- Posts: 282
- Liked: 26 times
- Joined: Nov 10, 2010 6:51 pm
- Full Name: Seth Bartlett
- Contact:
Re: Script to start all backup jobs and then wait
Okay, if I could delete my posts, I would, but my mistakes show that I'm human
Here is the revised code:
Here is the revised code:
Code: Select all
$Jobs = Get-VBRJob
$Jobs | Start-VBRJob -RunAsync
$JobList = New-Object System.Collections.ArrayList
foreach($Job in $Jobs)
{
$JobList.Add($Job)
}
while($JobList.Count -ne 0)
{
foreach($Job in $Jobs)
{
if($Job.IsStopped() -eq $true)
{
$JobList.Remove($Job)
}
sleep 10
}
}
Run your BackupExec here.
Skype: Sethbartlett88 - Make sure to label who you are and why you want to add me
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Twitter: @sethbartlett
If my post was helpful, please like it. Sometimes twitter is quicker to hit me up if you need me.
Who is online
Users browsing this forum: No registered users and 7 guests