dnyan_linux has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

I am new to perl and trying to write script which will verify first if veritas volume manager is running. if it is running then stop it and print the output veritas volume manager has stopped.

i wrote below code but not able to print it like " volume <volume name> has stopped.

#verify volume is in running state #!/usr/local/bin/perl @list = ("vxinfo -g <diskgroup name> <volumename>","vxinfo -g <diskgr +oup name> <volumename>" "); # foreach loop execution foreach $a (@list){ $result = `$a`; print "output of command $a is $result\n"; }

i need to check here if volume is running then stop it else print error. but i am not able to write code. also in above section it is printing output of commnad is. i need output "status of volume is :"

print "stopping the volume\n"; $vol1 = `vxvol -g <diskgroup name> stop <volumename>`; $vol2 = `vxvol -g <diskgroup name> stop <volumename>`;

need code for verify voulume is stopped and print it like "volume <volume name > has stopped"

Replies are listed 'Best First'.
Re: script to stop veritas volume manager
by 1nickt (Canon) on Jul 19, 2017 at 17:28 UTC

    Hi, welcome, please put your code in <code></code> tags. Didn't you notice in preview that your post is barely comprehensible? Please review the documentation in the PerlMonks FAQ (link provided to the right) and edit your post.


    The way forward always starts with a minimal test.