Forum Discussion

NIKHIL234656595's avatar
13 years ago

bpdbjobs

bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}'

 

384 womble_ad_disk Full 1333911123 1333911123

383 womble_ad_disk Full 1333910914 1333910940

382   1333890199 1333890202

381   1333846995 1333846998

380   1333803792 1333803795

379   1333760589 1333760599

378 flump Full 1333724587 1333724600

377   1333717385 1333717388

376   1333674181 1333674192

375 CatBack_Disk Full 1333645255 1333645270

374 CatBack_Disk Full 1333645222 1333645250

373 CatBack_Disk Full 1333645201 1333645251

372 CatBack_Disk - 1333645200 1333645270

 

I need this output with heading on top like job id,policy etc and time not in ctime format.

 

What to do?

  • Could you please try to work things out for yourself, you are now asking non netbackup questions on a netbackup forum.  I gave all the answers in the thread.  Createing scripts should not be part of this forum.

    If you do not know how to make a very simple script that contains two lines I have given, I suggest you get yourself on some training very very quickly.  Anyone who admins a backup environment should be able to do this.

    You know, sometimes I get stuck, I use Google, the answers are almost always there, yes, it might take me an hour to find, but it is there.  

    Let's try it ..

    http://www.linfo.org/create_shell_1.html

    ..and the first example on the page, is almost the same as what I created, it has an echo statement, and  you can probably work out you need to add the bpdbjobs line.

    It took me < 2 minutes to find that.

    Here was the clue ...

    "You can get round this, using scripting"

    Here are the lines, I've added #! /usr/bin/ksh as it's now a script

    #! /usr/bin/ksh

    echo "jobid  policy  schedule  started  ended"  

    bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}' |awk 'NF == 5'

     

    Put the three lines in a file, called <myscript>.sh

    chmod 755 <myscript>.sh

    Run the script (if you are in the same directory where the script is located, you will probably need to run ./<myscript>.sh.

    The headings will not line up with the output, this I think would be quite difficult in unix shell.

    I'm not near a server but the output will look like :

    jobid  policy  schedule  started  ended

    378      flump     Full             1333724587 1333724600

    However, it doesn't matter, your life will not end if the formatting is a bit out.

    Unix shell is not there to make things look pretty, it is there to be functional.  If you want really neat formatting, use perl.

    Eddited, the line I thought would work, doesn't so answer as above.  The tabs didn't work either, so the formatting would be quite difficult.

    Martin

     

     

7 Replies

Replies have been turned off for this discussion
  • Could you please try to work things out for yourself, you are now asking non netbackup questions on a netbackup forum.  I gave all the answers in the thread.  Createing scripts should not be part of this forum.

    If you do not know how to make a very simple script that contains two lines I have given, I suggest you get yourself on some training very very quickly.  Anyone who admins a backup environment should be able to do this.

    You know, sometimes I get stuck, I use Google, the answers are almost always there, yes, it might take me an hour to find, but it is there.  

    Let's try it ..

    http://www.linfo.org/create_shell_1.html

    ..and the first example on the page, is almost the same as what I created, it has an echo statement, and  you can probably work out you need to add the bpdbjobs line.

    It took me < 2 minutes to find that.

    Here was the clue ...

    "You can get round this, using scripting"

    Here are the lines, I've added #! /usr/bin/ksh as it's now a script

    #! /usr/bin/ksh

    echo "jobid  policy  schedule  started  ended"  

    bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}' |awk 'NF == 5'

     

    Put the three lines in a file, called <myscript>.sh

    chmod 755 <myscript>.sh

    Run the script (if you are in the same directory where the script is located, you will probably need to run ./<myscript>.sh.

    The headings will not line up with the output, this I think would be quite difficult in unix shell.

    I'm not near a server but the output will look like :

    jobid  policy  schedule  started  ended

    378      flump     Full             1333724587 1333724600

    However, it doesn't matter, your life will not end if the formatting is a bit out.

    Unix shell is not there to make things look pretty, it is there to be functional.  If you want really neat formatting, use perl.

    Eddited, the line I thought would work, doesn't so answer as above.  The tabs didn't work either, so the formatting would be quite difficult.

    Martin

     

     

  • Hi Nikhil,

    In bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}

    Just remove the -most_columns option and remove -F, in awk and try the command.

    You get it in normal time instead of ctime.

    Anyway, The netbackup command to convert the ctime to normal time is

    bpdbm -ctime <ctime>.

  • Run a extra line ...  substitute in the column names ...

    The 1st, 5th, 6th, 9th and 11th fields are ...

    jobid, policy, schedule, started, ended

    echo "jobid, policy, schedule, started, ended"  

    bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}'

    But this will not work well.

    Here is an example from my system

    95   1341585665 1341585672

    94 steve_test full 1341585619 1341585683
     
    Jobid 95 has no policy, as it was not a backup job, it was a image cleanup job.
    So , just using echo will show the column names  when they are empty.
     
    You can get round this, using scripting , you know the command now, so it is not difficult to remember the the last 2 columns are start/ end time.  The first 3 are easy to work out.

    The time will only be in ctime format, no option, unless you change the command, but as you asked how to get 'normal' time using this command "bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}'" - it cannot be done without scripting.

     

    Martin

  • @Martin:I want heading on top like job id,policy,start time,end time etc.

    What needs to be changed for this?

     

    I want like this below when i run the command.

     

    Job id  policy schedule         start tme     end tme

    378      flump     Full             1333724587 1333724600

     

    And the command which u have given gives  only:

    378      flump     Full             1333724587 1333724600

  • I did ...

    echo "jobid, policy, schedule, started, ended"  

    bpdbjobs -most_columns |awk -F, '{print $1" "$5" "$6" "$9" " $11}' |awk 'NF == 5'

     

    (I've put |awk 'NF ==5' ) on the end to only allow it to print the line if there are 5 fileds.

     

    Martin