There's a few threads around which document how to get FFS to run with cron (I am setting up some automated backups). However these involve a kludge using (deprecated) xvfb.
Perhaps an enhancement to enable FFS to run without requiring any GUI resources would be possible? It runs fine in Windows scheduler, it has an issue with Linux.
Feature Request: FFS run on headless Linux.
- Posts: 13
- Joined: 12 Mar 2026
- Posts: 13
- Joined: 12 Mar 2026
Really, really would like to see this! After a few days (weeks?) my cron backups fail with errors related to GUI. Unless I am doing something wrong in my script...
"Authorization required but no authorization protocol specified"
"Unable to initialize GTK+, is DISPLAY set properly?"
"Authorization required but no authorization protocol specified"
"Unable to initialize GTK+, is DISPLAY set properly?"
- Posts: 346
- Joined: 7 Jan 2018
It sounds like you are willing to try with what you call a deprecated solution. The beautiful thing about open source software is you can still choose to use deprecated software; nobody can take it away from you. (Well, glibc can move on, but you can keep your OS on the older libs too.)
So, can you describe your current setup completely? Perhaps you are using Xvfb. Can you show your cron entry, and the shell script that the cron entry invokes?
So, can you describe your current setup completely? Perhaps you are using Xvfb. Can you show your cron entry, and the shell script that the cron entry invokes?
- Posts: 13
- Joined: 12 Mar 2026
I don't know of another solution other than running xvfb - can you clarify? Google says: While Xvfb (X Virtual Framebuffer) is not strictly deprecated by the upstream X.org project, it is increasingly considered legacy and is being phased out in modern Linux environments in favor of more robust alternatives.
Here's my crontab:
#DISPLAY=:0
#XAUTHORITY=/home/keith/.Xauthority
runscript="/home/keith/.ffsync/runffs.sh"
# DOW: 0/7 = Sun; 1 = Mon ... 6 = Sat
#
# Backup
#
# m h dom mon dow command
#
# Every day.
00 02 * * * $runscript "[FFS SVR] TV to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
# 59 * * * * $runscript "[FFS SVR] TV to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
#
# Mon, Wed, Fri
00 03 * * 1,3,5 $runscript "[FFS SVR] SD to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
#
Here's my script (sorry it's a little messy as I have experimented with various options).
#!/usr/bin/bash
datetime=$(date +"%m/%d %T")
killall xvfb 2>/dev/null
#rm -f /tmp/.X99-lock
#Xvfb :99 -screen 0 1024x768x24 &
#XVFB=$!
export DISPLAY=:0
Log=/home/keith/.ffsync/ffslog.log
#[[ -f $Log ]] && mv $Log "$Log".old
echo $datetime: Starting FFS run for "$1" >> $Log
#echo $datetime: Starting FFS run for "$1" "(xrunffs). Xvfb process is $XVFB." >> /home/keith/.ffsync/ffslog.log
xvfb-run -a /opt/FreeFileSync/FreeFileSync /home/keith/.ffsync/"$1" >> $Log 2>&1
#/opt/FreeFileSync/FreeFileSync /home/keith/.ffsync/"$1" >> /home/keith/.ffsync/ffslog.log 2>&1
datetime=$(date +"%m/%d %T")
echo $datetime: FFS run for "$1" ended. >> $Log
echo "---------------------------------------------" >> $Log
#echo $datetime: FFS run for "$1" ended. Killing process $XVFB. >> /home/keith/.ffsync/ffslog.log
#kill $XVFB >> /home/keith/.ffsync/ffslog.log 2>&1
killall xvfb >> $Log 2>/dev/null
[[ -f "/home/keith/.config/FreeFileSync/Logs/*.html" ]] && mv /home/keith/.config/FreeFileSync/Logs/*.html /mnt/nuc/ffs_logs
I will welcome all insights. The situation seems to appear after a period of time, maybe a few days or weeks. My last uptime was 30+ days, it stopped working a few days prior. I rebooted yesterday and all ran OK last night. I don't ideally want to keep on rebooting, so if there's some cleanup I can do to keep this running, I will do that.
Thanks for looking.
Here's my crontab:
#DISPLAY=:0
#XAUTHORITY=/home/keith/.Xauthority
runscript="/home/keith/.ffsync/runffs.sh"
# DOW: 0/7 = Sun; 1 = Mon ... 6 = Sat
#
# Backup
#
# m h dom mon dow command
#
# Every day.
00 02 * * * $runscript "[FFS SVR] TV to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
# 59 * * * * $runscript "[FFS SVR] TV to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
#
# Mon, Wed, Fri
00 03 * * 1,3,5 $runscript "[FFS SVR] SD to FileStore.ffs_batch" >> /home/keith/.ffsync/cronlog.log 2>&1
#
Here's my script (sorry it's a little messy as I have experimented with various options).
#!/usr/bin/bash
datetime=$(date +"%m/%d %T")
killall xvfb 2>/dev/null
#rm -f /tmp/.X99-lock
#Xvfb :99 -screen 0 1024x768x24 &
#XVFB=$!
export DISPLAY=:0
Log=/home/keith/.ffsync/ffslog.log
#[[ -f $Log ]] && mv $Log "$Log".old
echo $datetime: Starting FFS run for "$1" >> $Log
#echo $datetime: Starting FFS run for "$1" "(xrunffs). Xvfb process is $XVFB." >> /home/keith/.ffsync/ffslog.log
xvfb-run -a /opt/FreeFileSync/FreeFileSync /home/keith/.ffsync/"$1" >> $Log 2>&1
#/opt/FreeFileSync/FreeFileSync /home/keith/.ffsync/"$1" >> /home/keith/.ffsync/ffslog.log 2>&1
datetime=$(date +"%m/%d %T")
echo $datetime: FFS run for "$1" ended. >> $Log
echo "---------------------------------------------" >> $Log
#echo $datetime: FFS run for "$1" ended. Killing process $XVFB. >> /home/keith/.ffsync/ffslog.log
#kill $XVFB >> /home/keith/.ffsync/ffslog.log 2>&1
killall xvfb >> $Log 2>/dev/null
[[ -f "/home/keith/.config/FreeFileSync/Logs/*.html" ]] && mv /home/keith/.config/FreeFileSync/Logs/*.html /mnt/nuc/ffs_logs
I will welcome all insights. The situation seems to appear after a period of time, maybe a few days or weeks. My last uptime was 30+ days, it stopped working a few days prior. I rebooted yesterday and all ran OK last night. I don't ideally want to keep on rebooting, so if there's some cleanup I can do to keep this running, I will do that.
Thanks for looking.
- Posts: 170
- Joined: 5 Jan 2024
Hi,
What if you tie your backup jobs into The real-time sync feature?
You won't have the whole gui running all the time but you will have a little icon down in the system tray.
That's probably the best you're going to do with ffs. And, as always there is more than one way to skin a cat.
What if you tie your backup jobs into The real-time sync feature?
You won't have the whole gui running all the time but you will have a little icon down in the system tray.
That's probably the best you're going to do with ffs. And, as always there is more than one way to skin a cat.
- Posts: 13
- Joined: 12 Mar 2026
Hi John, I wasn't familiar with the RTS function but I tried it. As I see it, it looks for changes in the file system and then starts FFS to handle them.
As far as solving the issue I have, I am not convinced it will work because eventually the FFS main program should trigger the issue. I cannot say yet it won't but I'll leave it running.
Note though, and this may be a showstopper, it appeared I had to manually start the RTS scan to make the FFS initiate. I am not using a Windows PC where you can get a file system event on change, I am not sure if my mapped folders to me network shares provide that kickoff event.
As far as solving the issue I have, I am not convinced it will work because eventually the FFS main program should trigger the issue. I cannot say yet it won't but I'll leave it running.
Note though, and this may be a showstopper, it appeared I had to manually start the RTS scan to make the FFS initiate. I am not using a Windows PC where you can get a file system event on change, I am not sure if my mapped folders to me network shares provide that kickoff event.