Solved

shell script

Posted on 2013-11-21
4
486 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
Utilizing an array to gracefully append to a list of EmailAddresses
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…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

717 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