2

I want to launch/run /usr/bin/FreeFileSync (FFS) from my crontab at most once a day, whenever the external backup target volume is mounted.

For that, I used @Germar's answer: i.e. a spooling-script that does a couple of tidy-up chores before calling a small backup-script as second argument to the spooling-script's basename. The called backup-script (the child process) in turn performs a check and calls FFS (the grand child process).

Because FFS opens its main GUI upon launch, I think I need to declare stdout for instance as:

DISPLAY=:0.1; export DISPLAY   # I have two screens

My question is whether I should declare my DISPLAY environment variable within the child script or within the parent spooling-script that calls it ?

Does @muru's answer applies in the case ? I.e. if I include the DISPLAY statement within the child script, do I need to source it inside the parent script, knowing I am dealing with an environment variable?

Cbhihe
  • 2,761
  • 3
  • 24
  • 47

1 Answers1

1

You have two options :

  1. You can use :

    export DISPLAY=:0.1
    

in the parent script. As we are using export the variable will be inherited by all child processes.

  1. You can use :

    DISPLAY=:0.1
    

in the child shell (if it calls further subshells use export in front). In this case as the child script is calling FFS just putting the DISPLAY in the child script will suffice.

heemayl
  • 91,753
  • +1 Excellent. So it is indeed different from passing variables with assigned values from sub-shells to parent shells. Thanks a lot @heemayl. I needed that little tap on the shoulder to put me on the right tracks on this. – Cbhihe Jul 14 '15 at 13:42
  • @Cbhihe glad i could help :) – heemayl Jul 14 '15 at 13:42