MacOS - Crontab - NO Email

Get help for specific problems
Posts: 5
Joined: 6 Oct 2020

eddiem5

I am using a Mac and want to run FFS without using the gludgy calendar mechanism suggested in the docs and often suggested by Apple.

So I created an automator routine exactly as described by FFS documents. the difference is instead of creating the calendar entry, I exported the automator routine as an application (.app).. The .app export runs perfectly in cron using the open directive.

For example:

20 21 * * * open /Users/eddie/Applications/RunBackupSync.app

Everything works well and as expected except, I get no emails when FFS is run from cron.

If I type at the command line the exact same command (open RunBackupSync.app),
I DO get the email.

I also tried various forms of screens in detached mode (screen -d -m) which I was sure would fix the problem by having a tty attached to the process, but to no avail, still no email.

Anyone have any good ideas??

Fyi, It seems like the emails are sourced from FFS corporate so I am wondering what is happening to cause this to fail?
User avatar
Site Admin
Posts: 7050
Joined: 9 Dec 2007

Zenju

Have a look at the log files. If sending emails fails for some reason the error message should give some clue.
Posts: 5
Joined: 6 Oct 2020

eddiem5

Nothing in the logs about anything to do with mailing errors.

Darn.
User avatar
Site Admin
Posts: 7050
Joined: 9 Dec 2007

Zenju

I'm not seeing any errors during email sending. Your last email was delivered on 2020-10-06 17:50 UTC.
Posts: 5
Joined: 6 Oct 2020

eddiem5

Hi and Thanks for your responses and trying to help...

I appreciate you checking your email logs but I don’t think the request to send the email is getting out in the cron cases..

The email you reference below was a run I did by hand within the Apple UI.

I have two computers, running a total of syncs 8 times per day between the two computers…

Things I tried...
I have tried turning on full disk access for freefilesync in the security and privacy preference.
I have tried using screen -m -d within cron so the app gets a tty attached.

My crontab look like: screen -d -m open /Users/eddie/Applications/RunBackupSync.app
Of course, I have also tried without the screen command and just calling open command.

Also, No log file get created during the runs from cron.

My issue is as follows:
Running from calendar is a pain as it put up an alert, informs the user, etc…
I just want silent running and the calendar entry technique doesn’t do that..

Fyi, the jobs do actual run as I can confirm on the sftp server logs showing the client connect, etc etc..
I just get no confirmation, emails or logs from freefilesync.

This is all a bummer as I love the app, it’s performance, flexibility, etc…

Just needs a little love on the mac platform as far as I can tell.

Thanks again - how can I help as a non-programmer?
User avatar
Site Admin
Posts: 7050
Joined: 9 Dec 2007

Zenju

I suspect that by using cron you are using a different user (root), so the logs are saved in a different folder:
/var/root/Library/Application Support/FreeFileSync/Logs
Posts: 5
Joined: 6 Oct 2020

eddiem5

Again, thanks for your attentions and suggestions..

That was a good idea to check the root application support area. Sadly the only thing there is the register.dat file. Meaning, there is a freefilesync directory but only that one file in it.

Fyi, when the cron job runs, the directory atime on the Log directory in ApplicationSupport area does get updated as if something happened but never see a log file itself.

Also when the job finishes, the GlobalSettings.xml file does get updated in the ApplicationSupport directory so I know the program can write to this area.

I am happy to do anything else you might suggest. The job does run and do a backup but there is no email, no log file written and little else externally to get status...
User avatar
Site Admin
Posts: 7050
Joined: 9 Dec 2007

Zenju

1. Maybe creating the "Logs" directory fails for some reason? If so, FFS can't report any errors and all you'd observe is a non-zero process exit code. I've added error logging to the console for 11.3 in this case. Hopefully it helps troubleshooting if someone is actually reading it...

2. It's also possible that "open /Users/eddie/Applications/RunBackupSync.app" is the problem. Maybe "RunBackupSync.app" is sandboxed? If so, the "Application Support" is at an entirely different location, if it is persisted at all.

Instead, I'd suggest you call FreeFileSync directly:
/Applications/FreeFileSync.app/Contents/MacOS/FreeFileSync <path to ffs_batch file>
3. Explicitly set a log directory in FFS sync settings (F8) and "Override default log path".
Posts: 2
Joined: 28 May 2021

ggbal01

I have the same issue of no log file generated. I don't use the default log path. I do explicitly set the log directory in FFS sync settings. The same batch file works fine when run from the calendar. Now I use cron instead due to the bug where batch file is triggered multiple times even I only set up one alert. I use the exact command line shown by Zenju. To debug the issue, I unchecked the auto-close. After the cron job was triggered and the FFS completed, I saw this error in FFS box
17:00:21 Error Cannot get process information.
/bin/sh: system_profiler: command not found

This seems to block the log file creation. Not sure how to get around it.
Posts: 2
Joined: 28 May 2021

ggbal01

Here is the solution. You need add following in your crontab
11 11 * * * export="<path to your system_profiler>:$PATH"; /Applications/FreeFileSync.app/Contents/MacOS/FreeFileSync <path to ffs_batch file>
Posts: 5
Joined: 6 Oct 2020

eddiem5

Thank you all for the suggestions but my sense is the Mac version of FFS is not fully baked..

So, I ended up leaving FFS and now use Cloud Berry Backup - runs fast, works perfectly and has a free version which works just fine.. In addition, I love the number of integrations to cloud services for backup destinations including SFTP which is what I was using with FFS.