Announcement

Collapse
No announcement yet.

cron does not launch an app

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    [DESKTOP] cron does not launch an app

    Hi

    I am trying to get OBS-Studio to start automatically at a preset time from a script and cron.

    1. the contents of my auto-record.sh script are
    #!/bin/bash
    date >> /home/user/Desktop/x.txt
    obs --startrecording

    2. I can double click on auto-record.sh on my file manager and OBS does launch.

    3. I then typed into terminal: "crontab -e"

    4. and enter the text
    */5 * * * * /home/user/Desktop/auto-record.sh

    5. when I save and exit the file the terminal prompt displays "crontab: installing new crontab"


    6. I leave things alone, and after a while the contents of x.txt are...

    Mon 26 Aug 2024 15:15:01 AEST
    Mon 26 Aug 2024 15:15:01 AEST
    Mon 26 Aug 2024 15:20:01 AEST
    Mon 26 Aug 2024 15:20:01 AEST
    Mon 26 Aug 2024 15:25:01 AEST
    Mon 26 Aug 2024 15:25:01 AEST
    Mon 26 Aug 2024 15:30:01 AEST
    Mon 26 Aug 2024 15:30:01 AEST
    Mon 26 Aug 2024 15:35:01 AEST
    Mon 26 Aug 2024 15:35:01 AEST​

    ...so it appears cron is running every 5 nmins (as per this test - before I set it to the actual time when I do need it to run).

    However the app OBS does not 'auto' launch.

    What else do I need to do to make cron able to launch OBS?

    Thanks!

    Cheers,
    skris88




    #2
    You'll need to specify the display when calling a GUI app this way


    It's a comon question

    Comment


      #3
      okay I have changed the script to say

      "export DISPLAY=:0 && obs --startrecording"

      THANKS!

      Comment


        #4
        Cron doesn't launch GUI apps unless you tell / explain him how to. You need to add env DISPLAY=:0 to your command.


        Last edited by newiron09; Nov 23, 2024, 05:25 AM.

        Comment

        Working...
        X