1847391 Members
2723 Online
110264 Solutions
New Discussion

Re: MC/SG package script

 
derek b smith
New Member

MC/SG package script

I have an app and it is running within my package where I want to bring down this app's processes down simultaneously. I have used a for loop to read in each site's config file, but it is not working! Can anyone help?

thanks
derek
3 REPLIES 3
Brian M Rawlings
Honored Contributor

Re: MC/SG package script

Derek: I suspect that we can provide some guidance, but you haven't given us very much to go on. It would let us help you, if you would go into a bit more detail.

Ordinarily, a package runs its control script, which starts and stops the app(s) by running an external command or script. You seem to be doing this, you mention a 'for loop' you are trying to use.

Does the script with the for loop work OK outside of the package? This can be difficult to confirm, since the package also activates and deactivates the VG used by the package, but manual activation of the VG to try your start/stop scripts is a normal part of MC/SG troubleshooting.

You want to bring down the app's processes simultaneously, and you mention multiple sites. Do you mean that you have this app running, in a package, at several sites, and that you want to stop all the apps simultaneously at the various sites? How would this be controlled, do you mean that, if any of the apps is stopped, the others should also stop immediately?

As in all Unix stuff, there are a dozen ways to do something, six of which are decent, and a couple of which are ideal. I'm sure that we can make some suggestions, if you will get more detailed.

We need: OS version, how are the sites connected, what exactly are you trying to do, and, a copy of the script that "doesn't work" would be useful.

Take Heart, the truth is out there somewhere.

Regards, --bmr
We must indeed all hang together, or, most assuredly, we shall all hang separately. (Benjamin Franklin)
Sean OB_1
Honored Contributor

Re: MC/SG package script

Derek,

A couple of things. What do you mean when you say it is not working? Is the script failing? Is it not shutting down some sites?

Looking at your script, as it is setup now it will only go through the loop once.

You set SITELIST to one site, then do a for on $SITELIST.

Is this simply as a test, or is this the finished script?


What I do is put my sites in a file the do

for $SITE in `cat /dir/to/file/sites`
do
.
.
.
done


Brian M Rawlings
Honored Contributor

Re: MC/SG package script

Sorry, Derek, didn't see the attachment earlier.

Some suggestions and questions:

1> Sean's response may help, and deserves some points. It may be that the single entry "hboctest" is for a server in your test environment, though, in which case it is OK as it is.

2> A few lines down is a line that says # set -x. If you remove the comment (# character), this should give a more verbose output when the script is run. That might help troubleshoot this.

3> What do you mean "not working"? Does it fail somewhere? Does it run, but fail to shut down the processes? Does it provide any output at all? What is the error message?

4> If the for loop only works once, and that is the problem, then Sean may have nailed it -- you aren't setting SITELIST to a list, only to a single entry.

5> If the problem you are having is further down in the script, well, there are several other scripts called (hcisetenv, setroot, setsite, etc). Do you know if they are working right, setting the variables, etc? you may need "echo" statements after each to make sure that they have done what you expect, back in this script.

6> If this script shuts down each 'site' in the 'SITELIST' and there are multiple sites, it doesn't seem compatible with MC/SG, which would need to have the 'cmhaltpkg -n ' command run at each site to halt the package itself. In other words, once an app is packaged into MC/SG, you just do the above command, and IT runs the shutdown script as a part of its function.
If you were trying to run this script on multiple nodes in one or more clusters, you would use this script (or one like it) as the "customer halt commands" script in your package control file, and your master shutdown script would do something like

remsh /usr/sbin/cmhaltpkg

with a line for each server/node on which you wanted to have this package halted. You could parse the output of 'cmviewcl' to see if the packages had stopped, once again using 'remsh' or whatever inter-system command launcher that suits your environment (ssh, etc).

Hope this helps, good luck!

--bmr
We must indeed all hang together, or, most assuredly, we shall all hang separately. (Benjamin Franklin)