Start a Conversation

Unsolved

This post is more than 5 years old

3196

January 27th, 2014 08:00

EMC AutoStart 5.4.1 - How to Create Rule to Restart Service

Hello everyone,

We are running EMC AutoStart 5.4.1 build 73. We have an issue with an older Apache Tomcat 6 service that has issues and requires a restart of the service to get the website back up an running. I know that you can create a Rule (with a script) that can use Triggers to run on a regular basis. How can we setup a Rule to restart the Apache Tomcat 6 service?

The Resource Group currently has the IP, Node Alias, Data Source, the MySQLServer service, and finally the Apache Tomcat service. If we use EMC to restart the service, due to monitoring on the Resource Group, the whole group restarts. We would like to avoid the entire group restarting when this service is restarted. So, with that, we'll have to disable monitoring as well on the Resource Group when this Rule is running.

If you can't accomplish this via a Rule to restart the service, can this be done to restart the Resource Group via a Rule?

I've attempted to find documentation on this and can't seem to find any working links.

Any help would be appreciated.

Thank you,

Johnathan

4 Posts

January 27th, 2014 09:00

Hello,

I see that via the 5.4.1 Administration guide that Perl is used with the Rules. I do not see any examples to work from though or to learn the syntax.

Anyone have any ideas?

Thanks,

Johnathan

January 30th, 2014 09:00

Hello,

We've decided to go a different route. Instead of EMC handling the shutdown of the service, we let a Windows Schedule Task do this. When EMC AutoStart sees that the service is offline, it restarts it. To get EMC AutoStart to do this, under the specific service that Windows is shutting down check the following two boxes:

"Restart on Failed State"

"Restart on No Response"

Now EMC brings the service online when Windows bring it offline nightly at 0200.

Works like a charm.

Thanks,

Johnathan

January 30th, 2014 09:00

@Emilio,

Thanks for the information.

Changing the default Service action under the Resource Group sounds like a good deal as if in the situation where it won't restart, there won't be a loop between the Windows Schedule Task and EMC starting the service repeatedly, instead it will failover.

I couldn't find anything useful with creating a Perl script for the Rule since we were wanting EMC to handle the Service restart. Creating the trigger was no problem, it was only the Rule script where we had issues. So, after figuring out those Service settings, using a Windows Schedule Task worked like we wanted to trigger the service shutdown so EMC can start it back up again. We only wanted the service to be restarted without the whole Resource Group being restarted.

I've seen some mention about a Programming Guide but I could never find a link that worked. Would you have any information on this or how to create the Rule script? Maybe another method to regularly restart a single service within EMC?

Any further advice would be appreciated. Thanks for providing what you have thus far.

Thanks,

Johnathan

63 Posts

January 30th, 2014 09:00

The default Resource Grouup setting for a Managed Service failure action is to "Shutdown & Restart Group".  The default setting can be changed, from the Resource Group settings tab, to simply "Restart" the Managed Service.  If Managed Service fails to restart three consequative times, then a relocation will be triggered.

With this setting change, the service can simply be scheduled to shut down via an AutoStart rule\trigger or via any other method.  The Resource Group would then be in charge of restarting the service.

January 30th, 2014 10:00

@Emilio,

Another question, is one method preferred over another (other than the 3 failed restarts then failover rule) and is there a reason why you would choose one over the other? What I'm referring to is the Resource Group setting for the Service over the Service specific settings I've mentioned.

Thanks,

Johnathan

63 Posts

January 30th, 2014 15:00

Jonathan,

The EMC AutoStart documentation portfolio previously had a separate document called the EMC AutoStart Programming guide, but the information was later rolled into the EMC AutoStart Administrator's guide.   The information that was previously in the Programming guide should now be in the "Programmer's Guide" section of the Administrator's guide.

A rule could definitely be used to stop the service, by writing a Perl script.  This sounds like the most logical way of doing it through AutoStart on a scheduled basis. The syntax of the Perl script would be beyond the scope of this guide, but I am sure there are plenty of resources online.

The Managed Service specific settings should not be used when it is used in a Resource Group.  The Resource Group should be used to control the behavior as these typically rely on other resources in the group.  These settings are independent and both settings would cause them to complete for the actions (similar to restarting the service outside).  The Managed Service specific settings are available for doing customizations (via custom rules) outside of a Resource Group configuration.

January 31st, 2014 07:00

@Emilio,

I appreciate the clarification. Sounds like the Resource Group service settings would be best.

I've been searching for some examples that would specifically imply EMC variables and I can;t find any. I have found some though that when run, the Rule disables but the service does nothing. I've tried the following as well as others (These are off the top of my head so please forgive some syntax incorrections. I am not that familiar with Perl but have used different programming languages previously (bash, batch, php, etc.).):

@rc = "net stop service";

@rc = "net start service";

As well as:

Win32::Service::stopService

(\\server, service);

Win32::Service::startService

(\\server, service);

It seems to me that either of the above would be initiated by EMC, but Windows would actually handle the starting and stopping of the service. Which I figured wouldn't be the best to implement this type of solution.

Different variations of the above I've tried as well and none of them work or the Rule disables as previously informed. Would you have any insight as to the correct syntax? Like I've said, I can't find anything that will work with EMC specifically.

Thanks,

Johnathan

No Events found!

Top