12.13 RestartService

Use this Knowledge Script to schedule a service to automatically stop and restart after a specified interval. You can also have the script restart any services that depend on the ones you have stopped. This script raises an event if it fails to restart a service. Note that you cannot use this script to stop the NetIQ Client Resource Monitor (netiqmc) agent service.

12.13.1 Resource Objects

Windows 2003 Server or later

12.13.2 Default Schedule

The default schedule for this script is Daily.

12.13.3 Setting Parameter Values

Set the following parameters as needed:

Parameter

How to Set It

Event Notification

Create event if service restarts successfully?

Select Yes to raise an event if the script successfully restarts a service and, optionally, its dependent services. The default is Yes.

Severity - Service restarted

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the script successfully restarts a service. The default is 25 (blue event indicator).

Create event if service restart fails?

Select Yes to raise an event if the script fails to restart a service. The default is Yes.

Severity - Service start failed

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the script fails to restart a service. The default is 5 (red event indicator).

Severity - Service stop failed

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the script fails to stop a service. The default is 5 (red event indicator).

Create event if service is missing?

Select Yes to raise an event if a specified service is missing. The default is unselected.

Severity - Service missing

Set the event severity level, from 1 to 40, to indicate the importance of an event in which a specified service is missing. The default is 8.

Create event if service is disabled?

Select Yes to raise an event if the script disables a service. The default is Yes.

Severity - Service disabled

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the script disables a service. The default is 12.

Create event if service is shut down normally?

Select Yes to raise an event if the script shuts down a service normally. The default is Yes.

Severity - Service shut down normally

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the script shuts down a service normally. The default is 30.

Severity - Job Failure

Set the event severity level, from 1 to 40, to indicate the importance of an event in which the RestartService job fails unexpectedly. The default is 10 (red event indicator).

Data Collection

Collect data?

Select Yes to collect data for charts and reports. If enabled, data collection returns:

  • 100 -- service was restarted successfully, or

  • 0 -- service did not restart.

The default is unselected.

Administration

Service list

Provide the names of the services to you want to stop. Separate each name with a comma (,) and no spaces. The default is Alerter,Messenger.

Service start/stop delay

Specify the number of seconds to wait after a service is stopped before attempting to automatically restart it. The default is 30.

Restart dependent services?

Select Yes to also restart any services that depend on the services you stopped. The default is Yes.

For example, if you stop the MSSQLSERVER service, the SQLSERVERAGENT service is also stopped. You can use this parameter to restart the agent service along with the server.

Service start/stop retry count

Specify the number of times to attempt to restart a service after it has stopped. The default is 3 times.

Restart service if shut down normally?

Select Yes to restart a service that is shut down normally. By default, this script restarts services that are shut down normally.