We use Windows Task Scheduler to call a number of batch files that upload data once every night to cloud storage.
I do not recall seeing a way to configure AlwaysUp to run a batch file once a day and not bother about trying to keep the batch file always running.
Did I miss a configuration setting that lets me run a batch file once a day and not restart it when it finishes, until the next scheduled time?
— RF
Hi RF, thanks for getting in touch.
Yes — AlwaysUp can definitely help you run your batch file reliably each day. Here’s how to put that in place.
Step 1: Install your batch file as a 24/7 Windows Service with AlwaysUp
The first thing to do it to install your batch file in AlwaysUp. Our easy to use Application Advisor will help you get you set up in a few minutes.
Please:
In AlwaysUp, click the “magic wand” icon () on the toolbar to launch the Application Advisor.
Advance past the welcome page, choose Batch file from the list of applications, and click Next to proceed:
Enter the full path to your batch file:
Next, enter the password for your Windows account:
Step through the rest of the process and click the Save button to add your batch file to AlwaysUp.
At this point, you have installed a batch file that AlwaysUp will run 24/7 — automatically restarting it if it ever stops for any reason. But that’s not what you want, right? Not to worry — we’ll address that overzealousness in the next step.
Step 2: Adjust your batch file to run once per day, at a set time
AlwaysUp features basic (but convenient) scheduling that allows customers to run programs periodically. You can find the relevant controls on the Restart tab when configuring your application.
To run your batch file once daily — say, at 7 AM, before you get into the office:
Edit your application in AlwaysUp (by selecting Edit/View Application from the Application menu).
Switch to the Restart tab.
Select the Not immediately, but option, select At and enter the time to run your batch file (7 AM):
Save your settings.
Going forward, AlwaysUp will now launch your batch file at 7 every morning.
One more consideration: Should your batch file run immediately when your AlwaysUp service starts?
If your goal is to run your batch file only at 7 AM, we actually have a bit more work to do. Let me explain.
As you probably know, AlwaysUp installed a Windows Service to manage your batch file. That service is will ensure that your batch file runs every morning at 7. But there’s one more time when the service will run your batch file: when the service starts.
For example, let’s say that your server reboots at 4:30 AM. Here’s what would happen:
4:31 AM: Windows starts your AlwaysUp batch file Windows Service.
4:31 AM: The AlwaysUp service starts your batch file.
4:36 AM: Your batch file exits (it ran for 5 minutes).
4:36 AM: The AlwaysUp service notices that your batch file has exited. It queues up the next run for today at 7 AM.
7:00 AM: The AlwaysUp service starts your batch file.
7:05 AM: Your batch file exits (it ran for 5 minutes).
7:05 AM: The AlwaysUp service notices that your batch file has exited. It queues up the next run for tomorrow at 7 AM.
So the question for you is: Is it OK for AlwaysUp to run your batch file when the service starts? Those extra, unscheduled runs can happen at any time — not only at 7 AM.
How to avoid unscheduled runs when the AlwaysUp service starts
If those additional, irregular invocations are unacceptable, then you must make one more change.
Edit your entry in AlwaysUp, return to the Restart tab and check the This delay applies to the first run as well box:
With that change in place, here’s what would happen at our hypothetical reboot at 4:30 AM:
4:31 AM: Windows starts your AlwaysUp batch file Windows Service.
4:31 AM: The AlwaysUp service schedules your batch file to run at 7 AM.
7:00 AM: The AlwaysUp service starts your batch file.
7:05 AM: Your batch file exits (it ran for 5 minutes).
7:05 AM: The AlwaysUp service notices that your batch file has exited. It queues up the next run for tomorrow at 7 AM.
As you can see, the extra run at 4:31 AM wouldn’t happen.
All the best running your batch file!