I am using Ubuntu 16.06 and here is my shell script:


recordmydesktop --quick-subsampling --fps 3 --no-sound --on-the-fly-encoding --v_quality 40 -o /home/square/Videos/test/rec_`date +%Y%m%d_%H%M%S`.ogv

when i run the script from the terminal like that ./script.sh everything goes well and running.

However when i place an cronjob looking like that:

*/1   *    *    *    *  /home/square/playground/script.sh &>/home/square/playground/mylog.log

The command:

recordmydesktop --quick-subsampling --fps 3 --no-sound --on-the-fly-encoding --v_quality 40 -o /home/square/Videos/test/rec_`date +%Y%m%d_%H%M%S`.ogv

Is not working. I have no idea why it is running when i run the script.sh from the terminal, but it is not working via the cron job.

Do you have any idea how i can fix that ?

  • Edit export DISPLAY=:0.0 in script. – d a i s y Nov 17 '16 at 10:40

recordmydesktop records the X-session it is started in.

Processes started from crontab don't have an X-session.

  • Is there anyway i can start that with cron or with the starting of the PC ? – Venelin Vasilev Nov 17 '16 at 10:03
  • I really don't think so. As far as I can see, you have to start it after you have logged in. – Soren A Nov 17 '16 at 10:13
  • 1
    But maybe you can use Startup Applications in your Desktop. It should be found in "Menu > Preferences > Startup Applications", see this article askubuntu.com/questions/30931/… – Soren A Nov 17 '16 at 10:15

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.