crontab freefilesync

Discuss new features and functions
Posts: 1
Joined: 21 Sep 2018

dudeden

Hello!
Tell me please how to run Sync.ffs_batch from the console on the crontab?
I use the command
/opt/FreeFileSync/FreeFileSync /root/Sync.ffs_batch

but I get an error
Error: Unable to initialize GTK+, is DISPLAY set properly?
I use CentOS 7.5
Thanks for any help!
Posts: 309
Joined: 7 Jan 2018

bgstack15

FreeFileSync is exclusively a graphical application as far as I know. This means that you need a working display (normally X11, or Wayland nowadays). An application normally works with a display defined by the environment variable DISPLAY.
The console is normally DISPLAY=:0. That is, the value is colon-zero. VNC or other remote sessions or other types of graphical sessions could have some different value.
So if you are sure you want a graphical application to run from cron, you should include before the application call the variable DISPLAY.
0 0 * * *   DISPLAY=:0 /opt/FreeFileSync/FreeFileSync /root/Sync.ffs_batch
Now, I don't have a fantastic understanding of displays. It tends to be that the display is owned by a user, so the process needs to be started by the same user who owns the display in question.

On Unix and GNU/Linux systems, a more traditional way to accomplish a scripted file synchronization job is to use rsync. I realize it's entirely different from FreeFileSync and would present an entirely different learning curve, but probably would solve the problem you are looking to resolve.