cancel
Showing results for 
Search instead for 
Did you mean: 

Shedule Windows overlap

Dackey
Level 4

Hello,

I create a script PowerShell to modify Schedule of Policy, i'm using the command line NBU, bpplschedwin.

The information for the PolicyName / ScheduleLabel  are in a Global Variable, the value for the day is in 2 array, one for the StartTimeJ the other StopTimeJ for the Time during NBU could do some backup. 

Start : 28/04/2020 19:00

StopTime: 29/04/2020 06:00

StopHebdo : 30/04/2020 06:00

    $Global:StartTimeJ = @()
    $Global:StopTimeJ = @()
    $i = 0
    While($i -le 13){
        $Global:StartTimeJ += "0"
        $Global:StopTimeJ += "0"
        $i++
    }
    $NbJourDiff = (New-TimeSpan -start $Global:Start -End $Global:StopHebdo).Days
    $StartTime= ""
    $i = 0
    While($i -le $NbJourDiff){
        $StartTime = (Get-Date $Global:Start).AddDays($i).ToString('dd/MM/yyyy HH:mm')
        $JourStartTime = (Get-Date $StartTime).DayOfWeek
        Switch($JourStartTime){
            Sunday{$Global:StartTimeJ[0] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Monday{$Global:StartTimeJ[1] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Tuesday{$Global:StartTimeJ[2] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Wednesday{$Global:StartTimeJ[3] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Thursday{$Global:StartTimeJ[4] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Friday{$Global:StartTimeJ[5] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}
            Saturday{$Global:StartTimeJ[6] = (New-TimeSpan -Start ($StartTime.Split(" ")[0]) -End $StartTime).TotalSeconds}    
        }
        $StopTime = (Get-Date $Global:Stop).AddDays($i).ToString("dd/MM/yyyy HH:mm")
        $JourStopTime = (Get-Date $StopTime).DayOfWeek
        Switch($JourStopTime){
            Sunday{$Global:StopTimeJ[0] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Monday{$Global:StopTimeJ[1] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Tuesday{$Global:StopTimeJ[2] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Wednesday{$Global:StopTimeJ[3] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Thursday{$Global:StopTimeJ[4] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Friday{$Global:StopTimeJ[5] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}
            Saturday{$Global:StopTimeJ[6] = (New-TimeSpan -Start $StartTime -End $StopTime).TotalSeconds}    
        }
        $i++
    }
}

Function ModificationSchedIncr(){
Set-Location "$PathNBUadmincmd"
Write-Host "PolicyName: $Global:PolicyName"
Write-Host "Label: $Global:ScheduleLabel"
Write-Host "Tableau StartTimeJ: $Global:StartTimeJ"
Write-Host "Tableau StopTimeJ: $Global:StopTimeJ"
.\bpplschedwin.exe $Global:PolicyName $Global:ScheduleLabel -0 0 0 -1 0 0 -2 0 0 -3 0 0 -4 0 0 -5 0 0 -6 0 0
.\bpplschedwin.exe $Global:PolicyName $Global:ScheduleLabel -0 $Global:StartTimeJ[0] $Global:StopTimeJ[0] -1 $Global:StartTimeJ[1] $Global:StopTimeJ[1] -2 $Global:StartTimeJ[2] $Global:StartTimeJ[2] -3 $Global:StartTimeJ[3] $Global:StopTimeJ[3] -4 $Global:StartTimeJ[4] $Global:StopTimeJ[4] -5 $Global:StartTimeJ[5] $Global:StopTimeJ[5] -6 $Global:StartTimeJ[6] $Global:StopTimeJ[6]
Write-Host " "
Write-Host "Modification du schedule :$Global:ScheduleLabel de la Policy: $Global:PolicyName éffectué " -ForegroundColor Green
}

When i just done a Write-Host of all value:

PolicyName: RGS_MGMT_P
Label: Incr
Tableau StartTimeJ: 0 0 68400 68400 68400 0 0 0 0 0 0 0 0 0
Tableau StopTimeJ: 0 0 0 39600 39600 39600 0 0 0 0 0 0 0 0

 

All the Value is good ! but i have this error :
.\bpplschedwin.exe : schedule windows overlap
Au caractère C:\Admin\NBUv5-EnCours.ps1:281 : 5
+ .\bpplschedwin.exe $Global:PolicyName $Global:ScheduleLabel -0 $G ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (schedule windows overlap:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError

When i done the same command line to a Full Schedule, the result of the command line is OK !

Do you know the meaning of this error and how to resolve it ?

 

Thx a lot for you'r help ;)

1 ACCEPTED SOLUTION

Accepted Solutions

sdo
Moderator
Moderator
Partner    VIP    Certified

Here's a tip.  To work out the structure, create for yourself a test policy and schedule with run windows of say three hours on a Saturday 10:00 to 13:00, and say four hours on Tuesday 23:00 to 03:00 - and then dump/report/show that schedule in raw form, and then inspect the structure of the numbers, and you'll see what I mean.

The documentation says:

-(0..6) start duration

Specifies the window during which NetBackup can run the backups for this schedule. This window applies to a specific day of the week. corresponds to Sunday, 1 to Monday, and so on.

start is the time at which the backup window opens for this schedule. This time is the number of seconds since midnight. It is an integer between 0 and 86400 (the number of seconds in a day).

duration is the length of time that the window remains open. The time unit is seconds. This unit is a non-negative integer.

.

So, to schedule for Monday 04:00 to 11:00, and for Turesday 05:00 to 07:00, then you need to specify as:

-1 14400 25200 -2 18000 7200 

i.e.
-1 = Monday
14400 = 04:00
25200 = 7 hours
-2 = Tuesday
18000 = 05:00
7200 = 2 hours

View solution in original post

2 REPLIES 2

sdo
Moderator
Moderator
Partner    VIP    Certified

Here's a tip.  To work out the structure, create for yourself a test policy and schedule with run windows of say three hours on a Saturday 10:00 to 13:00, and say four hours on Tuesday 23:00 to 03:00 - and then dump/report/show that schedule in raw form, and then inspect the structure of the numbers, and you'll see what I mean.

The documentation says:

-(0..6) start duration

Specifies the window during which NetBackup can run the backups for this schedule. This window applies to a specific day of the week. corresponds to Sunday, 1 to Monday, and so on.

start is the time at which the backup window opens for this schedule. This time is the number of seconds since midnight. It is an integer between 0 and 86400 (the number of seconds in a day).

duration is the length of time that the window remains open. The time unit is seconds. This unit is a non-negative integer.

.

So, to schedule for Monday 04:00 to 11:00, and for Turesday 05:00 to 07:00, then you need to specify as:

-1 14400 25200 -2 18000 7200 

i.e.
-1 = Monday
14400 = 04:00
25200 = 7 hours
-2 = Tuesday
18000 = 05:00
7200 = 2 hours

Hello,

 

Yes i have found ^^

When the script is running it Switch with The JourStartTime, and the other Switch are done with JourStopTime, so it's why the structure of the value was false ;)

 

Thx for help ^^