Direkt zum Inhalt

Sleep computer after multiple backups

Thread needs solution

I would like to sleep my computer after running several backup jobs. My thought would be to do this via command line. However, I'm not skilled enough to figure out how to do these sequentially, then sleep the computer.

Below is a list of the backup jobs to run and the sleep command. Please advise, thank you.

"C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"1638F9A0-015B-4EE5-83F7-6357EB7F2816"
"C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"42425E82-AEC7-451A-855E-C1047A2308FB"
"C:\Program Files (x86)\Common Files\Acronis\TrueImageHome\TrueImageHomeNotify.exe" /script:"D13879A5-515E-492F-87AE-0EAA3E752692"

C:\Utilities\NirCmd\nircmd.exe standby

exit

Scott

0 Users found this helpful

Scott, is this something you would be doing regularly or just on demand?

You can start the three backup tasks at the same time, but they will execute sequentially. ATI only runs one at a time. If your computer is set to sleep after a period of inactivity, that will occur after the final backup completes. Probably no need to rush it.

I don't expect the command approach would work as the batch file would complete but ATI would be running so the sleep wouldn't happen.

Ditto to Bruno, if your PC is set to sleep after a set number of minutes of inactivity, then there should be no need for trying to force it to do so.

My own PC's wake up to perform scheduled backups and then return to sleep after around 10 minutes after the backup has finished.  ATI would normally prevent sleep while the backup is active via the Advanced options on the Scheduler page for the Task options.

Thanks Bruno & Steve. This would be a scheduled, Nightly Task. I have my computer run all day... I basically live at my computer during the day. Plus, I have it setup also as my media server/streamer.

My other thought was to set each job to run like 5 seconds after one another. I'm hoping this would execute the jobs sequentially, in the same order every night. If so, I could add a script to the last backup job to execute a sleep bat file when finished?

 

Scott, I don't believe that you can set the schedule as fine as down to seconds, but you could set it to a minute or so inbetween tasks.  I typically have my tasks to 15 minutes separation when running multiple by schedule, and find that that works fine for me, allowing for regular full backups after 5 or 6 incrementals etc.

Again, I have never needed to force the PC to go to sleep after running backups as the Power options set let it go back to sleep automatically after a set period of being idle!

The one consideration if using your sleep.bat file as a Post Command, is that ATI may regard that the task didn't finish successfully because the bat file doesn't return a successful exit code back to ATI due to forcing the PC to sleep!

I would recommend creating a simple test backup task with the Post Command and your bat file and then see what is shown for that task when your restart / wake the PC, and check that ATI doesn't try to re-run the backup after the restart!

The idea with the 5 secs... Presently, I have my backups set to all run at the same time in ATI, and they're run sequentially, though I don't know if it's the same order every night. Adding a 5 sec offset I thought would place them in order, sequentially.

Where there's a will there's a way... For the POST bat file... I simply create 2. One bat file to execute and finish, executing another bat file that actually sleeps my PC :-)

I'll run some tests and report back. Thanks!

Scott, I'm not sure this will work although I am awaiting your results.

My suspicion is that there may be a synchronization issue where the sleep may not happen as you don't return to ATI. If that is the case, let me suggest an alternative.

Create a batch file which will wait a bit and then run your sleep, e.g...
REM Wait for one minute to let everything finish up
timeout /t 60
REM Put the computer to sleep
C:\Utilities\NirCmd\nircmd.exe standby

Create a Scheduled Task to execute this batch file.

Finally, create a Post-command from your last backup to run the Scheduled Task
SCHTASKS /run <task>

I have not tested this out.

As for starting the three backup tasks, just schedule them a minute or so apart and all should be fine.

 

Thanks Bruno.

A couple wrinkles... I had forgotten that Cloud backups do not have the Pre/Post command options. Secondly, I get to my computer around 5:30 locally every morning and don't want to have my PC go to sleep on me. I may need to re-think my whole backup schedule.

 

Scott, not sure I understand your concern about the PC going to sleep on you. If you are using the PC, it won't go to sleep. And if it does you can wake it right up.

I guess I really don't understand what you are trying to achieve here. Why can you not just schedule the backups so they all run sequentially at night and let the PC just go to sleep based on normal timeout after the last one completes?

Here's my concern... If backups last longer than the time the computer is not in use, this seems to me that the Sleep command will still be executed. I find my backups, at times, last a long time. I presently have them set to start at 1:30 am.

Your reference of the computer not going to sleep if using it... I'm not certain I understand. If the Sleep task is executed, it will sleep on me regardless.

Once I'm at my computer early morning, I can't have it randomly sleep on me. For reference, I'm a day trader and certainly don't want my computer sleeping on me if in a trade.

On this topic, is it possible to send some type of Stop command? I could not find any reference for such.

I understand this is a bit convoluted... Reason to maybe find a different backup schedule.

Edit: one option is to use If/Then in the bat file to not sleep if beyond a certain time.

Scott, taking a few steps backwards for this topic:

Does your PC wake from sleep in order to perform your backups at 1:30am?

Does your PC go to sleep when it is idle, regardless of any open applications?

To have the PC wake from sleep requires that your Power options have wake timers enabled, and that your Acronis tasks have the option set to wake the PC from sleep to run a scheduled task in the Options > Schedule > Advanced settings.

For the PC to go to sleep, then your Power options should be set to allow this both on battery and on power connected modes (if present).

The screen shots below are from my HP laptop which does daily backups, woken from sleep, then returns to sleep again as is on battery at the time!

I have the sleep option for when plugged in set longer (2 hours) because the laptop is typically doing Windows Updates which warn not to Power off when they are active!

The next screen image shows the Advanced Schedule options that work with the above power options.

I have backups starting from 08:00 each day then at 15 minute intervals. 

One of the benefits of being retired is that I get to stay in bed longer while these tasks do their daily backups, but I am up & around to ensure the laptop doesn't need to be plugged in when the backups do a regular full backup which takes longer.

I have an older laptop doing a similar backup routine but which I have connected to a timer socket to switch on power for the time of the backup due to the battery draining much quicker but which still wakes up, backs up and returns to sleep just fine!  All without needing any post command or other methods to lull it back to sleep!

Thanks, Steve. I completely understand everything you referenced. To this point, I really have not had it sleeping at all, but wanted to start doing this. I can sleep it, and wake it via hardware input, ie. mouse or keyboard. My issue is two-fold... I seem to be at my computer a lot. Second, I presently have it also set up as my Plex media server/streamer in a VM, for which I have it shared with family/friends.

I made some adjustments to my backup setups. I created a new backup and overnight, it only took 1.5 hrs to locally backup full images of my 3 main disks. I also set up separate cloud backups for each of the disks, scheduled to cleanup on different days. Anyhow, I'll let these run this week and see how long they take.

At that point, I'll follow the recommendation from Bruno and use an if/then statement in my sleep bat file. Basically, it will execute sleep if before 5:30 am. I think this is the best I can hope for.

Some questions...

1) Is there a command to stop any active ATI backup?

2) Referencing the option "Back up only when computer is locked..." If the backup does not start because the PC is unlocked/no screensaver, will it continue to try, or is that scheduled backup skipped?

3) If that backup is skipped, will it be ran at the next scheduled backup time? Regardless, I assume the backup still follows the plan, ie. if I have it create a full backup after x incremental, a full backup will be created the next scheduled time if one was required?

4) In the below Post-command screenshot, there are 2 options. The first, "Do not perform..." Which commands execution is this referring to?

Last tidbit... I had not considered of the idea of any backup running on a shorter repeating schedule. I'll need to try this, assuming this will not severely impact any media transcoding.

Scott, have you ever had an experience where you are in the middle of doing something and the computer goes into Sleep? It only goes to sleep when idle and the idle time is specified in the power settings. It should never just suddenly enter sleep state while you're working on it. Perhaps your idle time is set too low?

It sounds like what you really want is for the computer not to go to sleep during the time you are trading. It is easy to create multiple power setting profiles. I suggest you set one profile for the time you are trading which may never sleep, or would sleep after say one hour of inactivity. Then set another which could have a more appropriate sleep setting. You can easily switch profiles either through the Control Panel power settings page, or via the powercfg command. You could even use the Task Scheduler to invoke powercfg on a time schedule so it can be made automatic.

Some questions...

1) Is there a command to stop any active ATI backup?

A) Not really other than the option in the ATI GUI which will cause the backup to Stop / Pause but with the exception of Cloud backups, would probably start the backup from the beginning again if not Resumed later.

2) Referencing the option "Back up only when computer is locked..." If the backup does not start because the PC is unlocked/no screensaver, will it continue to try, or is that scheduled backup skipped?

A) When I last tried using that particular option, the backup never seemed to run at all because the PC was never deemed to be idle, but that was some time ago, so you would need to try it for your system scenario and see what happens!

3) If that backup is skipped, will it be ran at the next scheduled backup time? Regardless, I assume the backup still follows the plan, ie. if I have it create a full backup after x incremental, a full backup will be created the next scheduled time if one was required?

A) Best answer I can give is 'probably' but mainly based on the fact that I haven't done any testing of this scenario.  The downside of any skipped scheduled backups is that it then displaces the day on which a future full backup will be performed, i.e. if you set up the backup to always create a full backup on a Saturday with incrementals on the other 6 days of the week but then skip the backup on Wednesday, then the full will move to Sunday.  That may not be an issue, but what if it runs on a work day?

4) In the below Post-command screenshot, there are 2 options. The first, "Do not perform..." Which commands execution is this referring to?

A) The option is referring to the Pre or Post command, where the intent in ticking that option is to wait on any further ATI actions until the Pre / Post command returns a positive exit code to say all ran successfully.

Bruno- Thanks for another great recommendation.

Steve- Thanks for the explanations.

I'll fiddle with all this during the week and report back. Thanks guys.

Another aspect of the Sleep topic I completely neglected was my Home Assistant; its server also runs as a VM on my main computer.

Best course of action for me is to invest in a Synology NAS to properly house my media, and my Media and HA servers. Then per @Bruno, set different Power Profiles. I can then have the Profiles changed via Task Mgr, a script ran through EventGhost, ie. whether my trading platform is open or not, or which Virtual Desktop I'm using. I'l wake my PC to run ATI backups and Sleep it again afterwards.

Once I have this setup, I'll report back herein with my setup.