Script Error Checking
Posted: Wed Feb 19, 2014 1:51 pm
Does anyone know if there is a good way to verify that a script is working correctly. I simply want to take a snapshot of a virtual volume on a daily basis, keep the snapped volume around for a few days and then delete it.
I know how to script it to get the virtual volumes created, and then to delete them, but it seems there is no way to confirm the virtual volume actuall has been created.
(This is from the HP manual.
Except where noted, the following codes are returned indicating success or failure for each individual
command:
• 0 indicates that the command was successful.
• 1 indicates that the command failed.
18 CLI Command Syntax and Conventions
Note that these exit status codes only indicate the execution status of the command itself. The results of individual CLI commands should be determined from the command output. For example, if you issue the addsnmpmgr command with an invalid IP address, the command output returns Invalid IP address and an SNMP manager is not added; however, the exit status is 0 (successful)
because the command itself was successfully executed, even though the intended result of the
command (adding an SNMP manager) was not achieved.)
It either returns an exit code of 0 if the script runs or a 1 if it does not run.
For example: Say I wanted to take a snap of a lun called lun 1. It I snap it I can create a file named lun1.daily. If i run the same script again it will attempt to create another lun1.daily which is not allowed (it will generate an error), however the script thinks it worked properly, because it's not smart enough to return a failure code. Of course I know I plan on running the create snap script once a day, so it should not duplicate the Virtual Volume name. I use this line in my code
cli createsv -ro @vvname@.@a@.nightly
Which will create a file name which is vvname.mon(dayofweek).nightly. How can I really confirm that the file is created each time.
Let me know if this does not make any sense.
I know how to script it to get the virtual volumes created, and then to delete them, but it seems there is no way to confirm the virtual volume actuall has been created.
(This is from the HP manual.
Except where noted, the following codes are returned indicating success or failure for each individual
command:
• 0 indicates that the command was successful.
• 1 indicates that the command failed.
18 CLI Command Syntax and Conventions
Note that these exit status codes only indicate the execution status of the command itself. The results of individual CLI commands should be determined from the command output. For example, if you issue the addsnmpmgr command with an invalid IP address, the command output returns Invalid IP address and an SNMP manager is not added; however, the exit status is 0 (successful)
because the command itself was successfully executed, even though the intended result of the
command (adding an SNMP manager) was not achieved.)
It either returns an exit code of 0 if the script runs or a 1 if it does not run.
For example: Say I wanted to take a snap of a lun called lun 1. It I snap it I can create a file named lun1.daily. If i run the same script again it will attempt to create another lun1.daily which is not allowed (it will generate an error), however the script thinks it worked properly, because it's not smart enough to return a failure code. Of course I know I plan on running the create snap script once a day, so it should not duplicate the Virtual Volume name. I use this line in my code
cli createsv -ro @vvname@.@a@.nightly
Which will create a file name which is vvname.mon(dayofweek).nightly. How can I really confirm that the file is created each time.
Let me know if this does not make any sense.