You can write a script that contains all of the information required to define a resource type and supply it to cluster_mgr by using the -f option:
cluster_mgr -f scriptname
Or, you could include the following as the first line of the script and then execute the script itself:
#!/usr/lib/failsafe/bin/cluster_mgr -f |
If any line of the script fails, cluster_mgr will exit. You can choose to ignore the failure and continue the process by using the -i option, as follows:
#!/usr/lib/failsafe/bin/cluster_mgr -if |
Note: If you include -i when using a cluster_mgr command line as the first line of the script, you must use this exact syntax (that is, -if).
A template script for creating a new resource type is located in /usr/lib/failsafe/cmgr-templates/cmgr-create-resource_type . Each line of the script must be a valid cluster_mgr line, a comment line (starting with #), or a blank line.
Note: You must include a done command line to finish a multi-level command. If you concatenate information from multiple template scripts to prepare your cluster configuration, you must remove the quit at the end of each template script.
For example, you could use the following script to define the same newresourcetype resource type defined interactively in the previous section:
# newresourcetype.script: Script to define the "newresourcetype" resource type set cluster test define resource_type newresourcetype set order to 300 set restart_mode to 0 add action start set exec_time to 40000 set monitor_interval to 0 set monitor_time to 0 done add action stop set exec_time to 40000 set monitor_interval to 0 set monitor_time to 0 done add type_attribute integer-att set data_type to integer set default_value to 33 done add type_attribute string-att set data_type to string set default_value to rw done add dependency filesystem done quit |
When you execute the cluster_mgr -f command line with this script, you will see the following output:
# /usr/lib/failsafe/bin/cluster_mgr -f newresourcetype.script Successfully defined resource_type newresourcetype # |
To verify that the resource type was defined, enter the following:
# /usr/lib/failsafe/bin/cluster_mgr -c "show resource_types in cluster test" NFS template newresourcetype statd MAC_address IP_address filesystem volume |