The Core Technologies Blog

Professional Software for Windows Services / 24×7 Operation


AlwaysUp Feature Spotlight: Scheduled Restarts

AlwaysUp Feature Spotlight: Scheduled Restarts

What is a scheduled restart and how can it help me?

We designed AlwaysUp to run your important programs 24/7, 365 days a year.

However, few Windows applications are built to run continuously for days and weeks. Sure, they start out great at first but soon enough they use up all your RAM, bog down the CPU, stop responding to network requests, or misbehave in some other way. Eventually, they break down.

If you’re lucky, that deterioration takes a long time. Indeed, you probably won’t even notice a slow decline if you routinely close the program before it becomes unusable.

But memory leaks and other imperfections eventually come to the forefront when you leave some programs running for a long time.

Regularly restart your program, to keep it “fresh”

The solution for a leaky program is to restart it every now and then. If you don’t give it a chance to run for too long, it won’t have time to deteriorate and fail.


How do I make AlwaysUp restart my application at a regular time?

To make AlwaysUp restart your application periodically, you have to:

  1. Configure AlwaysUp to stop your program at the desired time, and

  2. Tell AlwaysUp to restart the application whenever it stops.

Here’s how to do that.

Step #1: Configure AlwaysUp to stop your program at the desired time

To stop your application on a schedule, edit your application in AlwaysUp and switch to the Monitor tab. From there, check the Every box to enable the “scheduled stop” functionality:

Setup a scheduled stop

If you expand the Day drop-down, you’ll see that AlwaysUp can stop and restart your program at different intervals. That includes:

  • Multiple times per day — every 1, 2, 4, 6, 8 or 12 hours;

  • Once every day;

  • Once per week, on the day of your choice.

Choose when to stop your app

Choose the period that works for your situation. From what we have seen, many customers favor once per week, with Sunday being the most popular day.

After selecting the period, you should set the time you want AlwaysUp to stop your application. Be sure to pick a time that minimizes disruption for anyone using your application.

Set the time

Note that for hourly periods, the time is the first time to recycle your application. For example, if you choose to restart every 2 hours and you set the time to 5:00 PM, the first restart will take place at 5 PM, the second at 7 PM and the third at 9 PM. And AlwaysUp will continue that cadence until it’s interrupted.

Next, you can tell AlwaysUp to avoid restarting if your program is busy or someone is using the computer. Just check the But only if the following conditions are met box, choose your metrics and define your thresholds:

Set conditions for your scheduled stop

And finally, check the Reboot the computer option if you want AlwaysUp to restart the PC. Sometimes that’s necessary if the operating system becomes sluggish or unresponsive over time.

Step #2: Tell AlwaysUp to restart the application whenever it stops

By default, AlwaysUp will restart your application immediately after it stops. Because of that, you may not have to make any changes here.

You can find the setting on the Restart tab:

Restart your app when it stops

Once you’ve checked the box at the top, you’re good to go. If it isn’t checked, AlwaysUp will not revive your application after the stop you configured in step 1.


Can you show me a few examples?

Sure!

Example #1: Restart every Sunday at 3 AM

Here’s what it looks like to stop your application once per week, early on Sundays:

Stop/restart your app every Sunday morning

Example #2: Restart hourly starting at midnight

If you’re running an unstable program, please accept our sympathies!

In that unfortunate situation, you can have AlwaysUp reset the buggy app every hour, at the top of the hour, like this:

Stop/restart your app every hour

Example #3: Reboot your computer daily at 1 AM

If restarting your application isn’t enough, you can setup an off-hours reboot like this:

Reboot your computer every night at 1 AM

What are your best tips for scheduling a restart?

Tip #1: Choose a “quiet” time to restart your application

Stopping and starting your application can be disruptive. What if someone is using the software at the time?

To reduce the chance of interruption, please stop your application at a time when no one is likely to be using it. At a minimum, try to avoid normal business hours. And if you can, confine the drama to the weekend or maintenance window. What time works best for you and your team?

Tip #2: When rebooting, only proceed if no one is logged on

Instead of simply restarting your application, you can choose to reboot the entire PC. But do you really want to do that if someone is logged in? That may result in frustration — and lost work.

So if you’re going to reboot, please consider activating the No one is logged on to the computer condition:

Reboot only if no one is logged on

Posted in AlwaysUp | Tagged , , , , | 2 Comments

2 Responses to AlwaysUp Feature Spotlight: Scheduled Restarts

  1. Rich F. says:

    When turning on the Reboot option, could you explain which RDP users would see the message, “You’re about to be signed out / AlwaysUpService is restarting this computer on behalf of application “XXXXXX”, as scheduled.” and if there is an auto timeout on the message.

  2. Hi Rich.

    AlwaysUp calls the InitiateSystemShutdownEx Windows API function to reboot the computer. A 60 second timeout is specified.

    As the documentation suggests, the “You’re about to be signed out” message is sent to all user logged in interactively. That applies to users logged in by RDP too.

Leave a Reply

Your email address will not be published. Required fields are marked *