batch job automatic in linux ubuntu

Get help for specific problems
Posts: 3
Joined: 16 Nov 2021

running_werner

First, sorry for my english!

In Windows 10 i use the Schedule-Planing to start a batch job automatically.
I can't fix this in Linux ubuntu...

i tried the desription in the manual but it doesn't work...

i also tried it with crontab with this command:
DISPLAY=:0.0 @reboot /usr/bin/FreeFileSync /home/username/Schreibtisch/Testbatch.ffs_batch

but it doesn't work...

maybe someone could help me!
Posts: 309
Joined: 7 Jan 2018

bgstack15

So far from your cron entry I can see that we need to rearrange some of the contents. Anacron (the default cron implementation for Ubuntu) will want to read the schedule (the "@reboot") part first. So your line should be rearranged this way:
@reboot  DISPLAY=:0.0 /usr/bin/FreeFileSync /home/username/Schreibtisch/Testbatch.ffs_batch
Now, this is my conjecture, so you don't have to take this part for gospel: Depending on how fast cron becomes available, and your display manager (gdm3 or lightdm or slim or similar) loads up X11 (or Wayland?) this FreeFileSync invocation might try to start before the X11 display :0.0 comes up, so FreeFileSync will fail out and not try again. You might need to experiment with adding a delay into your cron entry, e.g.:
@reboot sleep 120; DISPLAY=:0.0 /usr/bin/FreeFileSync /home/username/Schreibtisch/Testbatch.ffs_batch
And a bonus note, some cron implementations like to send the standard output and standard error to the root user as an email message. FreeFileSync as a typical graphical program doesn't really use these, but GTK and other elements used in the graphics portion can throw warnings or errors based on your theme (which is unrelated to FreeFileSync and safe to ignore almost all the time), so you might choose to throw these output streams to /dev/null.
@reboot  DISPLAY=:0.0 /usr/bin/FreeFileSync /home/username/Schreibtisch/Testbatch.ffs_batch 1>/dev/null 2>&1
Posts: 3
Joined: 16 Nov 2021

running_werner

thanks so much!
it finally worked with the "sleep 120" and the Display after the reboot and the last 1>/dev/null/ 2>&1
Posts: 7
Joined: 17 Nov 2021

mariosm1cy

Hello, Do you know how to kill DISPLAY=:0.0 after the cron job has finished? I have two jobs running at midnight and I see the desktop processes (xfdesktop) running all the time (24x7) consuming ram. Maybe something that can kill the started desktop after the job finished?
Posts: 309
Joined: 7 Jan 2018

bgstack15

Xfdesktop is part of Xfce desktop environment and will be there, usually for a logged-in user. The login screen (aka "display manager") such as gdm3 or slim shouldn't have Xfdesktop running. And FreeFileSync wouldn't need Xfdesktop running nor would it start Xfdesktop. What user owns the xfdesktop processes: root, or your username?

I forget; does FreeFileSync always close out when the batch job is done? I don't use batch jobs myself; I use it manually on demand.
Posts: 3
Joined: 16 Nov 2021

running_werner

What is XFdesktop or Xfce desktop? And what exactly means GNOME? I'm new with linux...

FreeFileSync closes when the batch job is done!
Posts: 309
Joined: 7 Jan 2018

bgstack15

The graphical environment you use is a collection of utilities that all work together to present a unified look and feel. Ubuntu by default uses GNOME (which version of Ubuntu determines which version of GNOME). The fact that you see xfdesktop running indicates that parts of Xfce desktop environment are installed and apparently running. Perhaps you are running Xubuntu which uses Xfce or have chosen to install and use the Xfce desktop environment that includes xfdesktop. It's kind of weird to see Xfdesktop running if you haven't signed in, but probably doesn't really matter.

We're getting off-topic for FreeFileSync, so if you want further guidance, send me a message at my username at gmail or on irc at libera.chat. I stay signed in to #devuan-dev there.
Posts: 7
Joined: 17 Nov 2021

mariosm1cy

Guys, the problem is with freefilesync (i am using v11.14 on xubuntu 20.04) running two cron jobs for two different backups using the same command as below:
DISPLAY=:0 /opt/FreeFileSync/FreeFileSync XXXXX.ffs_batch

Everything works great but after the sync job I have constantly three xfdesktop processes running instead of one!
See image. Should the two been killed after the two freefilesync jobs completed?
Screenshot_2021-11-22_10-58-00.png
Screenshot_2021-11-22_10-58-00.png (14.4 KiB) Viewed 1566 times