Solved

shell script

Posted on 2013-11-21
4
473 Views
Last Modified: 2013-12-11
I start a application from the cmd line by running cmd below:
~]# /bin/su - xsis -c "/tool/apps/DMC/xsistest/xsis/scripts/start-sis -u xsis -p ALL"

the script=start-sis
xsis= app account
path to the script to start the app =  "/tool/apps/DMC/xsistest/xsis/scripts/start-sis -u xsis -p ALL"
I am looking for a wrapper script to run cmd above to start the app. The app is on a 2 node active/passive cluster. I want to have the cluster service run the wrapper script to execute the cmd when the cluster failover.

Thnx!
0
Comment
Question by:binadmin
  • 2
  • 2
4 Comments
 
LVL 19

Expert Comment

by:simon3270
ID: 39668486
Just write this in a file:
#!/bin/bash

/bin/su - xsis -c "/tool/apps/DMC/xsistest/xsis/scripts/start-sis -u xsis -p ALL"

Open in new window

This assumes that the script needs to run as a foreground task (which is common with High Availability systems, so that the HA system can monitor a specific process ID easily)
0
 

Author Comment

by:binadmin
ID: 39669296
after it execute the third line can it hand off/stop running...Im concern this file or script might execute the cmd and stay around and eventually become a rogue process...Anyway to make it exit after it execute.

Any thoughts?
0
 
LVL 19

Accepted Solution

by:
simon3270 earned 500 total points
ID: 39677278
I'm not sure what you want this to do (compared with your other wrapper script), and what start-sis actually does.

If start-sis starts the SIS program in the background, then it will complete execution and the script will finish, with no "rogue" processes running.

if start-sis runs the SIS program in the foreground, and doesn't finish until the SIS program itself has finished, then you'll have a couple of spare processes - the script itself, and the "su" command.  these should continue as long as start-sis runs.  you can reduce this number by one by adding "exec " to the start of the "su" line - in that case, the script itself is replaced by the "su" command.
0
 

Author Closing Comment

by:binadmin
ID: 39711514
We used the init script provided by the vender..Thnx alot for ur help.
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now