Forum Discussion

SARA_8's avatar
SARA_8
Level 4
13 years ago

vmchange script

I have a script to eject multiple tapes every week using vmchange. I dont have a root access on the master but I can run the command using pbrun

cat eject.sh
*
*
*
pbrun vmchange .....

each time I run the script , it asks me for my password then it executes fine.

./eject.sh

Password for ....

is there a way to automate the script to read my password from a file or something without me interacting with the script each time I run it.

 

Sincerely, Sara

  • You could add a further line that runs a command to pipe out the used tapes and then use that in my script .... but in view of exactly what you want I think you should consider purchasing the Vault option that will do this for you.

6 Replies

  • Sara, 

    This is not a NetBackup question, but a shell scripting question.

  • This would break your companies security 'procedures' - therefore I wouldn't even recommend even thinking about this.

    Martin

  • Why not just install a WIndows Admin Console on your PC and run all command from there

    Create a batch file named tape_eject.bat and in it put the following - ensuring anything between the <> symbols matches your envorinoment - (and then remove the <>):
     
     
     
    for /f "tokens=1,2" %%a in (eject_tapes.txt) do "<installpath>\netbackup\volmgr\bin\vmchange" -res -m %%a -mt <HCART> -rh <robothostname> -rt <tld> -rn <0>  -h <emmservername>-rc1 %%b -e -sec 1
     
    "<installpath>\veritas\volmgr\bin\vmupdate" -rt <TLD> -rn <0> -rh <robothostname> -h <emmservername> -use_barcode_rules
     
    Create a text file named tape_eject.txt and put it in the same directory as the .bat file you have just made.
     
    In your library view in the GUI sort your columns so that the first column is the MediaID and the second column is the Slot Number.
     
    Highlight the tapes you want to eject and hit CTL-C to copy the information.
     
    Paste it into the text file and save it.
     
    Run the .bat file. This will eject the tapes in the list and also update the inventory in NetBackup once it has finished.
     
    Dont put more tapes in the list than you have eject ports though!
     
    Hope thie helps

     

  • Thanks, but the goal of the script is to fully automate the process of ejecting tapes every week.

    If someone has a solution I will be soo thankful smiley

     

  • You could add a further line that runs a command to pipe out the used tapes and then use that in my script .... but in view of exactly what you want I think you should consider purchasing the Vault option that will do this for you.