Quick Tip: Ensure services restart upon failure in Windows 7

There are times that you need to make sure a service restarts when it fails in Windows 7. Jack Wallen shows you how to configure a service to accomplish this task.

There are times that you need to make sure a service restarts when it fails in Microsoft Windows 7. One very clear instance of this is the Quickbooks database manager (either for Point of Sale or Financials). Should the DB server for either of those applications quit (for whatever reason), all client machines will be unable to connect to the data file. This can mean disaster in a busy retail situation. To avoid this, you need to make sure that service is configured so that it will restart should it stop.

Believe it or not, this Windows 7 task is not difficult. The only challenge is knowing that you do, in fact, need to make sure a particular service does need to remain running at all times and you have to know where the tool is to set this up.

This blog post is also available in PDF format in a TechRepublic download.

Stay on top of the latest Microsoft Windows tips and tricks with TechRepublic's Windows Desktop newsletter, delivered every Monday and Thursday. Automatically sign up today!

Step 1: Assesing the job

Before you tackle this task, you must make sure that the service in question must be running 24/7. Such is the case of the Quickbooks Point Of Sale database manager. If that service is off, business is not being transacted. To make matters worse, should a register machine be in the middle of a transaction, that transaction could cause serious problems with the system if it loses contact with the data file.

There are also services that you might not want to set up to restart upon failure. Why? If a daemon is damaged or corrupt, attempting to auto-restart that service could cause problems with the system or even the entire network. With that information in mind, you want to make sure the service is a good fit for setting up to auto-restart.

Step 2: Starting the tool

The tool you will work from is the Services manager (Figure A). To start up this tool, do the following:

1.  Click the Start button.

2.  In the search box, type services.msc and hit Enter.

Figure A

You can quickly see if the service is running or not by looking in the Status column.

Step 3: Configuring the service in question

Now, we have set up the service to restart upon failure. To do this, right-click the service you want to configure and select Properties. This will open the Service Properties windows. From within this window click on the Recovery tab (Figure B).

Figure B

There are a number of ways you can handle these types of errors: You can restart the service, run a program, and even restart the computer.

In order to direct the service to restart upon failure, you have to configure it to do so for First, Second, and/or Subsequent failures. How often you will attempt to restart the service could depend on how flaky the service is. If the service is fairly reliable and would only stop for critical reasons (and subsequent restarts could do more harm than good), you might want to consider only restarting the service on the First failure.

To set the service to restart, just select Restart the Service from the drop-down menu associated with First Failure. Should you feel comfortable setting this service to restart upon second failure, go ahead and do that. In the case of Quickbooks, I always set all three to restart.

You can, however, opt to have the machine simply restart upon either second or subsequent failures. This is a judgment call that must be made by the administrator. If this machine is a server, it's probably not a good idea to restart it upon the failure of a nonmission critical service.

Should you want to have the machine restart on a specific service failure, all you need to do is select Restart the Computer from the drop-down menu associated with First, Second, or Subsequent failure. When you do, you can then configure the restart to begin after a set number of minutes as well as set it up to broadcast a message to users.

To do this, click on the Restart Computer Options button and configure the number of minutes you want to give the restart after the failure occurs as well as the message you want to send. Click OK after you have set these options.

After you have configured this service to react to failure, click OK to set the changes and dismiss the window. Congratulations, your service should now automatically restart should it fail.

Final thoughts

Always use caution when dealing with the automatic restart of services. Although this tool can really aid you in your quest to keep your system and services running smoothly, it can also rear up and bite you in the butt. A good bit of planning and caution will go a very long way to help you nail this setup.

By Jack Wallen

Jack Wallen is an award-winning writer for TechRepublic, The New Stack, and Linux New Media. He's covered a variety of topics for over twenty years and is an avid promoter of open source. For more news about Jack Wallen, visit his website jackwallen....