I use the geany text editor, which has a command line option to list all open documents. The following command works fine when run from the command line:

/usr/bin/geany --list-documents > /home/myname/geanylist.txt

I want to run this regularly in cron, but it does not work. I have tried:

  • putting the above command directly into my crontab
  • wrapping the above command in a bash script, and calling that in my crontab
  • defining all normal path and other environment variables in the script
  • copying the entire contents of my .bashrc into the script
  • redirecting stderr and stdout to a log file (no help)

No matter what I do, when the crontab runs, ~/geanylist.txt will not contain the output from geany --list-documents, though it will contain any other output generated by the script. I am at a loss. How can I make this work? Is there another system utility besides cron I can use that will let me do this?

The best solution I can think of is to create a script with a loop that runs the command and then sleeps for 24 hours - surely there is a better way?


  • The result of /usr/bin/geany --list-documents, when run from the CL, is a list of full paths to (usually ascii txt) files, one per line, on stdout.
  • When adding the command or script to my crontab, I use crontab -e, with $EDITOR set to nano. This is the same way I have added many other commands to my crontab, all of which work properly (none of these other commands attempt to run geany in any way).
  • 1
    What is the output of /usr/bin/geany --list-documents and how you add the task to the crontab? crontab -e, sudo crontab -e? – Braiam Oct 12 '13 at 22:06
  • @Braiam: see edit at bottom of main post. – user201185 Oct 12 '13 at 22:19

A wild guess: geany running from cron does not have access to your DISPLAY; try adding DISPLAY=:0

  • Thanks for the suggestion, but it didn't help. – user201185 Oct 13 '13 at 18:41
  • You were right about this, but for reasons I don't understand, the solution is to pass the display as an option to geany, rather than to define the environment variable. – user201185 Oct 14 '13 at 7:50

Solution found here: https://sourceforge.net/p/geany/bugs/999/

* * * * * /usr/bin/geany --display=:0.0 --list-documents > /home/myname/geany_files.txt

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.