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 ...
  • mph999's avatar
    13 years ago

    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