2

I've the following command in my crontab to make automatic backups using FreeFileSync. It was working just fine on Ubuntu 20.04 but I've noticed it doesn't work anymore on Ubuntu 21.10.

30 12 * * * DISPLAY=:0 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1

I've first added >/dev/null 2>&1 following the suggestion in this post because I found in /var/log/syslog it generated the following error:

(CRON) info (No MTA installed, discarding output)

I don't have any error anymore in /var/log/syslog after the following line:

(toto) CMD (DISPLAY=:0 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1)

However, nothing seems to happen. FreeFileSync never starts.

It seems that there is a solution here which involves uninstalling the flatpak version of FreeFileSync and reinstalling it from the run-file of FreeFileSync website. I would prefer to keep the flatpak version because it makes automatic updates of the package.

Many thanks for your help.

EDIT: I've replaced >/dev/null by >/home/toto/crontab.log to redirect the error to a log file. Here is the error I get:

bwrap: Can't find source path /tmp/.X11-unix/X0: No such file or directory

There is a discussion about Flatpak involving such error here, but I'm not skilled enough to understand what solution they are suggesting.

TVG
  • 327
  • 1
    You may need to add the full path to the flatpak executable. cronjobs run in a very limited environment. – vanadium Feb 16 '22 at 09:14
  • Thanks for your reply. Do you know how can I get the full path to the flatpak executable? – TVG Feb 16 '22 at 09:23
  • which flatpak – vanadium Feb 16 '22 at 09:29
  • OK, I see, I thought you meant the full path of the FreeFileSync flatpak executable. Here, you suggest to use the following command: DISPLAY=:0 /usr/bin/flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/dev/null 2>&1. Is that correct? I've tried like this but it doesn't work either. – TVG Feb 16 '22 at 09:41
  • 1
    If you want information on why something is not working, don't throw away its error (and output) messages by redirecting them to /dev/null - redirect them to a file that you can look at like /home/toto/crontab.log – steeldriver Feb 16 '22 at 12:50
  • Thanks for the tip! I get the following error in the log file: bwrap: Can't find source path /tmp/.X11-unix/X0: No such file or directory. I'm adding it to the post. – TVG Feb 16 '22 at 13:26
  • 1
    So did you verify that your active display is actually :0? – steeldriver Feb 16 '22 at 13:30
  • Thank you so much! It is actually :1. It is working just fine now! – TVG Feb 16 '22 at 13:34

1 Answers1

1

Thanks to the nice people providing useful comments, here is the solution:

The active display was incorrect. I got the actual active display with echo $DISPLAY which returns :1.

Then, the following CRON command is now working:

30 12 * * * DISPLAY=:1 flatpak run org.freefilesync.FreeFileSync /home/toto/Backup.ffs_batch >/home/toto/crontab.log 2>&1
TVG
  • 327