cancel
Showing results for 
Search instead for 
Did you mean: 

Run a Script in Veritas? How can i view it online in the Cluster Explorer?

AdrianoRodrigue
Level 3

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.

1 ACCEPTED SOLUTION

Accepted Solutions

mikebounds
Level 6
Partner Accredited

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

View solution in original post

7 REPLIES 7

mikebounds
Level 6
Partner Accredited

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

AdrianoRodrigue
Level 3

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?

AdrianoRodrigue
Level 3

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?

mikebounds
Level 6
Partner Accredited

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

mikebounds
Level 6
Partner Accredited

You need to use one or more of:

  1. PIDFile
  2. MonitorProgram
  3. MonitorProcesses

So you don't need to use PIDFile if you use MonitorProgram.

Mike

AdrianoRodrigue
Level 3

Thank you Mike. I will take the test it told me that.

AdrianoRodrigue
Level 3

Thank you Mike. It worked out that his suggestion.