10-31-2011 01:47 PM
Hello, How do I run a script in Veritas? how can I view it online in the Cluster Explorer?
I have installed Veritas Storage 5.1 linux with two nodes and would like to make the mount a few directories on your network. In Resource Type has a mount option, but it's not that I need, so it have the option to mount the disks that comes from storage.
In my case I created a script to mount these directories on the network and would like to put these scripts in veritas. What resource do I choose?
Thank you.
Solved! Go to Solution.
10-31-2011 04:05 PM
Are you saying you want to mount a windows share in your linux cluster - i.e a samba Mount - in this case I think you are correct, you cannot use Mount agent. You can mount NFS mounts using mount agent in which case the BlockDevice is host:/mount_dir, but I don't think this is supported for Samba mounts, but you could try using the Mount agent if VCS lets you specify smbfs for FSType
But you can use your script using "Application" resource type as outlined in my last post - for example create a script called samba_mnt.sh something like:
win_share=$2 mount_point=$3 lock_file=/tmp/.DO_NOT_REMOVE_$4 case "$1" in start) # command to mount windows share - something like mount -t smbfs $win_share $mount_point if [ $? -eq 0 ] then touch $lock_file exit 0 else exit 1 fi ;; stop) rm $lock_file exit 0 ;; monitor) if [ -f $lock_file ] then exit 110 else exit 100 fi ;; *) echo "Usage: $0 {start|stop} win_share mount_point lock_file exit 1 ;; esac
Then create Application resources, for example like:
Application smb1 (
StartProgram = /opt/VRTSvcs/bin/samba_mnt.sh start winhost:/smb1 /smb1
StopProgram = /opt/VRTSvcs/bin/samba_mnt.sh stop winhost:/smb1 /smb1
MonitorProgram = /opt/VRTSvcs/bin/samba_mnt.sh monitor winhost:/smb1 /smb1
)
Application smb2 (
StartProgram = /opt/VRTSvcs/bin/samba_mnt.sh start winhost:/smb2 /smb2
StopProgram = /opt/VRTSvcs/bin/samba_mnt.sh stop winhost:/smb2 /smb2
MonitorProgram = /opt/VRTSvcs/bin/samba_mnt.sh monitor winhost:/smb2 /smb2
)
I haven't tested any above, so I can't be sure it is syntactically correct, but I have done this sort of thing before so the concept works.
Mike
10-31-2011 02:28 PM
You can use Application resource to run custom scripts which works as follows:
StartProgram: Run script and touch a lockfile
MonitorProgram: Check lockfile exists
StopProgram: Remove lockfile
But why do you need to use scripts, why can you not use Mount or CFSMount resource - can you explain what script does and why Mount or CFSMount resources cannot be used.
Mike
10-31-2011 03:16 PM
Mike, the Veritas has the option to mount, but I need a fstype is a BlockDevice. In my case I did not answer.
I've created the disk groups and volumes, now I just want to make a mount a windows share that the network for the two machines from my linux cluster. The only option I could think of was to create a script that performs this, but I'm not able to find the correct resource to use in this case to call a script.
Do you know another way to do this?
10-31-2011 03:58 PM
was looking here, the Application resource requires a PidFile, in this case would not be the ID of the script running?
In my case I just wanted to run the script and then he would've shut down and would no longer have the PidFile. VCS as the bored and ran the script as he put the resource as online?
10-31-2011 04:05 PM
Are you saying you want to mount a windows share in your linux cluster - i.e a samba Mount - in this case I think you are correct, you cannot use Mount agent. You can mount NFS mounts using mount agent in which case the BlockDevice is host:/mount_dir, but I don't think this is supported for Samba mounts, but you could try using the Mount agent if VCS lets you specify smbfs for FSType
But you can use your script using "Application" resource type as outlined in my last post - for example create a script called samba_mnt.sh something like:
win_share=$2 mount_point=$3 lock_file=/tmp/.DO_NOT_REMOVE_$4 case "$1" in start) # command to mount windows share - something like mount -t smbfs $win_share $mount_point if [ $? -eq 0 ] then touch $lock_file exit 0 else exit 1 fi ;; stop) rm $lock_file exit 0 ;; monitor) if [ -f $lock_file ] then exit 110 else exit 100 fi ;; *) echo "Usage: $0 {start|stop} win_share mount_point lock_file exit 1 ;; esac
Then create Application resources, for example like:
Application smb1 (
StartProgram = /opt/VRTSvcs/bin/samba_mnt.sh start winhost:/smb1 /smb1
StopProgram = /opt/VRTSvcs/bin/samba_mnt.sh stop winhost:/smb1 /smb1
MonitorProgram = /opt/VRTSvcs/bin/samba_mnt.sh monitor winhost:/smb1 /smb1
)
Application smb2 (
StartProgram = /opt/VRTSvcs/bin/samba_mnt.sh start winhost:/smb2 /smb2
StopProgram = /opt/VRTSvcs/bin/samba_mnt.sh stop winhost:/smb2 /smb2
MonitorProgram = /opt/VRTSvcs/bin/samba_mnt.sh monitor winhost:/smb2 /smb2
)
I haven't tested any above, so I can't be sure it is syntactically correct, but I have done this sort of thing before so the concept works.
Mike
10-31-2011 04:08 PM
You need to use one or more of:
So you don't need to use PIDFile if you use MonitorProgram.
Mike
10-31-2011 04:48 PM
Thank you Mike. I will take the test it told me that.
11-01-2011 01:08 PM
Thank you Mike. It worked out that his suggestion.