Suggestions for the manual - scheduling batch jobs

Discuss new features and functions
Posts: 2
Joined: 10 Oct 2019

Post by Retne • 10 Oct 2019, 17:24

Hi there.

I'm a long term user of FreeFileSync (who has recently noticed his contribution ended a little while ago, but anyway...) and I have a few suggestions for the Scheduled Task help page [].

They're mostly quite small things (tiny in some cases!), but things I think might need to be highlighted to be that bit more helpful. I did troubleshooting on my own, but these extra notes or changes could have saved me looking a bunch of things up.

Oh, and I looked for a way to submit this to git / other repo knowing this is OSS, but couldn't find anything. Have I missed that?

I'll put these here as a list and I'm aware they are my own experiences etc... This is a mix of small quick things and slightly bigger issues

The help page shows the following

"By default, FreeFileSync will show a progress dialog during synchronization and will wait while the summary dialog is shown. If the progress dialog is not needed, enable checkbox Run minimized and also set Auto-Close if you want to skip the summary dialog at the end.
Even if the progress dialog is not shown at the beginning, you can make it visible at any time during synchronization by double-clicking the FreeFileSync icon in the notification area."

First up for scheduled tasks you *want* to make this choice, don't you? If you don't hide the errors and the UI the scheduled task doesn't finish. I'd make this much stronger here (given we're talking scheduled tasks here not just batch jobs). For scheduled tasks, you likely don’t want the progress dialogue.

And please note there that the UI might not show up anywhere a user can see – you might need to open the notification area icons on the taskbar - not all folks will know to look there.
It would be useful to keep the numbering going - the W10 bullets would become 5-8, Mac 5-10. It might remind folks like me who knew how to create batch jobs that the stuff above that line was important (the notes on ignore errors), and wouldn't hurt anyone, I suspect.
I think it would be great to say what results might be expected (and even what to do with them).
I ignore errors so the task might run and have an error or two still showing. That's fine, but I then want a way to monitor it.

In my instance that was an extra job to check the status of two different batch files and email me if there was an issue (I'll post it below, and happy to add extra comments - just showing it here in case it's of interest to others). I was going to use the Scheduled task email command, but that's depreciated.

Of course, there is then the issue of that batch job failing, so it might be worth adding a final job to email weekly to say there's no problems as opposed to that one that reports problems.
On Windows it might be worth suggesting the task isn't allowed to run for three days, in most cases. At least have people think about that.
I haven't created any jobs on Mac, but might add an extra post here about that or I'm happy for someone to beat me to it!
Oh, and what are the output codes from running a batch job? I might just have missed seeing them.

Cheers all,


Posts: 2
Joined: 10 Oct 2019

Post by Retne • 10 Oct 2019, 17:30

# Here's the powershell I created to monitor those tasks and let me know if there was a problem:

# List of tasks to check. Can just do one - remove the "," and 2nd name, or add a "," and third name
$ScheduledTaskNames = "FolderName[ifUsed]FromScheduledTasks\TheScheduledTaskName", "FolderName[ifUsed]FromScheduledTasks\TheScheduledTaskName"

foreach($ScheduledTaskName in $ScheduledTaskNames) {
$Result = (schtasks /query /FO LIST /V /TN $ScheduledTaskName | findstr "Result")
$Result = $Result.substring(12)
$Code = $Result.trim()

If ($Code -ne 0) {
# Handy debugging line below for checking this PowerShell script. When the task is running normally as a scheduled task, comment out the line below with a #, as here
# Write-Output ($ScheduledTaskName + ' : ' + $result.ToString())

$User = ""
$Pass = ConvertTo-SecureString -String "YourReallySecurePassword" -AsPlainText -Force

$Credentials = New-Object System.Management.Automation.PSCredential $User, $Pass

$From = "Alert - Scheduled Sync Task Fail <>"
$To = "Your name probably <>"
$Subject = "Scheduled task 'Backup' failed"
$Body = $ScheduledTaskName + ' : ' + "Error code: $Code"
$SMTPServer = "" # for example...
$SMTPPort = "587"

Send-MailMessage -From $From -To $To -Subject $Subject -Body $Body -SmtpServer $SMTPServer -port $SMTPPort -UseSsl -Credential $Credentials

# This send one email per failed task (or one that worked but has a clash, perhaps)
# I can add the scheduled task xml for this too if that would be useful. Perhaps an "Advanced" page with a link to that in the Note column?

User avatar
Site Admin
Posts: 5084
Joined: 9 Dec 2007

Post by Zenju • 15 Oct 2019, 13:39

Great feedback! I've integrated most of your suggestions. Email OTOH might be a great feature for FFS to offer directly (viewtopic.php?t=3842), ideally one would just enter his email address without any configuration.