A place to discuss Backup software and online services
You are not signed in.
Is it possible to run a script (BAT/CMD file) before or after the IDrive backup runs?
I've got my backups scheduled for 2am, so I could of course run something at 1:55am. But is there a way to automatically run a script after backup completes, rather than having to guess at when it might be done?
Offline
bribri wrote:
I've got my backups scheduled for 2am, so I could of course run something at 1:55am. But is there a way to automatically run a script after backup completes, rather than having to guess at when it might be done?
No need to guess when its done
When IDrive is running a backup, it uses a process called idwutil_600.exe, so the script you run at 01:55 could stay running and monitor that process until it disappears.
tasklist | findstr "idwutil_600.exe"
will return errorlevel of zero if the task is not running, so you could loop until that happens (with some sort of pause*, to avoid too many resources being used), then continue the rest of the script and perform the after-backup tasks.
* depending on your version of Windows, you should have the timeout command, which will pause for the number of seconds you specify as a parameter.
Offline
This seems to work, adjust it for your needs:
@echo off Setlocal EnableDelayedExpansion rem Pre-tasks... rem rem echo Waiting for backup to start :WaitForStart timeout 10 tasklist | findstr "idwutil_600.exe" if NOT "!errorlevel!" == "0" goto WaitForStart echo Backup started timeout 600 rem 10 minute wait here to allow "Prepare file list" to complete. :WaitForFinish timeout 10 tasklist | findstr "idwutil_600.exe" if "!errorlevel!" == "0" goto WaitForFinish echo Backup finished rem Post-tasks... rem rem endlocal
The reason for the 10 minute wait is because idwutil_600.exe starts when the Prepare file list begins, but seems to quit again a few seconds later, then doesn't run until the backup actually starts.
You may need to play with this value.
Offline