Video Screencast Help
Symantec to Separate Into Two Focused, Industry-Leading Technology Companies. Learn more.

How to setup appplication script with configuration file

Created: 20 Feb 2014 | 9 comments
mokkan's picture

Hello,

I need to start an application with configuration file. How can i setup in VCS? I need to start some thing like this.

/opt/script/abc.sh  xxxxx.config

How can I setup on the resrouce?

Discussion Filed Under:

Comments 9 CommentsJump to latest comment

Gaurav Sangamnerkar's picture

Hello,

You can use either process agent or application agent

ProcessAgent

https://sort.symantec.com/public/documents/sfha/6....

ApplicationAgent

https://sort.symantec.com/public/documents/sfha/6....

Please note, VCS monitor exit codes are different that unix ones. VCS understands 110 as successful exit code while 100 as unsuccessful exit code. Make sure your monitor scripts contains these exit codes to ensure VCS monitors the resource correctly.

G

PS: If you are happy with the answer provided, please mark the post as solution. You can do so by clicking link "Mark as Solution" below the answer provided.
 

Arojasbe's picture

Hello,

The problem you can have it you have to define the path of the configuration file. If it's a Unix system. For example:

/opt/script/abc.sh  /opt/config/xxxxx.config

Regards

Setu Gupta's picture

If your application can be monitored through a single process, then you can use the Process agent.

If there are multiple processes in your application or you need to monitor through Pid files or you need to specify a custom way of monitoring the application, then you will have to use the Application agent.

Also, if your application can be monitored through a single process, but the process changes its identity as seen from process table, then you will not be able to use Process agent. You will have to use Applicatioin agent in this case too.

The custom script used for monitoring the application (applicable for Application agent only) should return 100-110 or 0 or 1 (only if you are using VCS 6.0 or later). The agent treats the return value of the custom script as follows:

0: Online

1: Offline

100: Offline

101-110: Online

Any other value: Unknown

HTH.

Marianne's picture

Have you downloaded the Bundled Agent Guide as suggested in previous posts?

The Bundled Agent Guide  contains details of how exactly to configure agents as well as examples.

https://www-secure.symantec.com/connect/forums/creating-application-under-vcs 

https://www-secure.symantec.com/connect/forums/networkhosts-attribute-question

https://www-secure.symantec.com/connect/forums/question-regarding-agent-setup 
PS: Please clear the solution for your own post in above discussion and then mark Mike's post as solution.

Supporting Storage Foundation and VCS on Unix and Windows as well as NetBackup on Unix and Windows
Handy NBU Links

mokkan's picture

Thank you very much for all of you.  What am I am doing is shutting down VMs and Starting VMs ( Vmware Guest).

The script will do

/opt/scripts/shutdown.sh

/opt/scripts/startup.sh

How do I configure this one. It doesn't have any agent. This is custom script?

hares -modify Vm_Resource StartProgram "/opt/script/shutdown.sh start"
 
hares -modify Vm_Resource "/opt/script/startup.sh stop"

Do I need to pass start/stop parameters? Or can I just do

hares -modify Vm_Resource StartProgram "/opt/script/shutdown.sh"
hares -modify Vm_Resource StartProgram "/opt/script/startup.sh"

mikebounds's picture

You do not have to pass parameters, but your scripts will need a monitor script, so your monitor script can check if the VM is running, or if you do not want to do this you can touch a file and monitor the file which can do by modifying your startup.sh and shutdown.sh to create and remove files or use a wrapper -  For exampe, create the following file called VM.sh in /opt/VRTSvcs/bin:script like:

LOCKFILE=/tmp/.{$2}.DO_NOT_REMOVE
case "$1" in
start)
    touch $LOCKFILE
    /opt/script/startup.sh;;
stop)
    rm $LOCKFILE   
    /opt/script/shutdown.sh;;
    ;;
monitor)
    if [ -a $LOCKFILE ]
    then
        exit 110
    else
        exit 100
    fi ;;
*) 
    echo "Usage: $0 {start|stop|monitor} lock_file
    exit 1
    ;;
esac 

Then create a resource using Application agent like:

Application vm1 (
  StartProgram = "/opt/VRTSvcs/bin/VM.sh start vm1"
  StopProgram = "/opt/VRTSvcs/bin/VM.sh stop vm1"
  MonitorProgram = "/opt/VRTSvcs/VM/VM.sh monitor vm1"
)
 
I have shown lockfile passed as an argument in case you have more than one VM you have to control, but if you only have 1, you can hardcode the name of the lockfile.
 
Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below

mokkan's picture

Thank you very much.  Do you know how I can run it on Windows?  I need to run it  from Windows machine.  Do you know how can I do? Your Unix syntax works for my unix machines.

Gaurav Sangamnerkar's picture

Hello,

You must to read out documentation ... Did you look at bundled agents guide for windows ? Go ahead & look at bundled agents guide & you should have your answers. Sample configurations are also mentioned in the bundled agents guide.

G

PS: If you are happy with the answer provided, please mark the post as solution. You can do so by clicking link "Mark as Solution" below the answer provided.
 

mikebounds's picture

As in post https://www-secure.symantec.com/connect/forums/windows-genericserivce-attribute-quesiton you will need to use VCS Process agent and if you want to monitor files rather than the VM, you will need to convert above script to batch, perl or vbs.

Mike

UK Symantec Consultant in VCS, GCO, SF, VVR, VxAT on Solaris, AIX, HP-ux, Linux & Windows

If this post has answered your question then please click on "Mark as solution" link below