cancel
Showing results for 
Search instead for 
Did you mean: 

Adding a schedule to a exisitng policy using command line

Vamsi1
Level 5

Team,

Need your help on adding & editing a schedule to the existing policies.

I have almost 150+ polices where I need to create a new schedule to all the polices. Instead of GUI I though command line would save my time and also I believe that is the way of smart working. So I started to create a policy using bpplsched  command. Got stuck with 2 issues 

1) Tring to create a yearly schedule which should be the last Saturday of the year. So I have included the date as "12/30/2016" in the command but in the schedule the date is reflected as " SPECIFIC DATE 0 - 01/07/1970"

./bpplsched <policy_name> -add <shcedule_name> -cal 1 -st FULL -rl 11 -ut -incl 12/30/2016

2) Also I’m try to add the start window for the schedule which throws an error all the time. Need your help with the syntax.

Here is the command which I was trying : (Backup Window should be Start time 6:00AM & End time : next day 22:00)

./bpplsched <policy_name> -add <shcedule_name> -cal 1 -st FULL -rl 11 -ut -incl 12/30/2016 –window 21600

Netbackup version  : 7.5.0.7

OS                              : Solaris

Do let me know if you need any more information to help me on this.

3 REPLIES 3

sdo
Moderator
Moderator
Partner    VIP    Certified

Your problem is with the use of the "-ut" switch.  If you specify "-ut" then you are telling the command to expect and interpret any dates in Unix universal time format.  IMO, when you use the "-ut" switch then the date validity checking is bypassed and the command simply does it's best to interpret the value of the date and so you are in effect getting a random date as a result.

Take out the "-ut" switch and try again?

sdo
Moderator
Moderator
Partner    VIP    Certified

For the run window, you cannot specify anything greater than 24 hours, i.e. 86400 seconds, for the "bpplsched" command, but you can for the "bpplschedrep" command.  And also note how the "bpplsched" command has a "-window" switch, whereas the "bpplschedrep" command does not and instead has a "-N start duration" switch, where N is a number representing a week day.

i) You want your run window to be 06:00 to 22:00 the next day, but this is not possible with only the "bpplsched" command on its own.

ii) If you specify "-window 21600 86400" then this would mean that the backups can and will start at 00:00 on 31st Dec.  But you don't want this.

iii) Specifying a run window using the "-window start duration" on the "bpplsched" command  means... setting a run window on every day of the week.  But you don't want this.

iv) A possible option is to specify "-window 21600 64800", i.e. from 06:00 to midnight.  This is the backup "window opportunity to start", i.e. a backup job which is actually started during this window will not be cancelled when the window expires.  However, any queued backups not yet started will expire when the window closes.  But you want to allow backups to start up until 22:00 the next day.

v) The solution is to use two commands, and because this year the 31st Dec is on a Saturday, so we need to specify day 6 in the second command, so maybe something like this:

# bpplsched TEST01 -add Annual -cal 1 -st FULL -rl 11 -incl 12/31/2016
# echo "$((6*3600))"
21600
# echo "$((18*3600))"
64800
# echo "$((22*3600))"
79200
# echo "$((64800+79200))"
144000
# bpplschedrep TEST01 Annual -6 21600 144000

...but you will need to adjust this each year, because next year (2017) the 31st Dec is probably not on a Saturday...

...you won't need the "echo" commands in your script, that is just me working out...

...start time of 06:00 = 21600 seconds

...seconds until end of day = 18 hours * 3600 = 64800...

...seconds from 00:00 to 22:00 = 22 * 3600 = 79200...

...so your run window duration is 64800 + 79200 = 144000.

HTH.

sdo
Moderator
Moderator
Partner    VIP    Certified

But I suspect that you will want to allow re-tries after run day, so use "-cal 2" instead of "-cal 1" on the first command.