Newish to Linux and slowly learning lol. I recently got a podcast downloader working through rss with castget, works great. The command to get new eps that haven’t been downloaded is castget -c.

Is there a way to automate this, so the command runs say every day at a set time?

  • vole@lemmy.world
    link
    fedilink
    English
    arrow-up
    2
    ·
    edit-2
    9 hours ago

    It would be because cron runs as the root user.

    Castget probably looks at the file path $HOME/.castgetrc. For your regular user, $HOME is probably /home/myamazingusername. For the root user, $HOME is probably /root .

    You can get a root terminal session by running sudo -i in a terminal console window. You can try running castget there to see what happens.

    Sudo -n:

    -n, --non-interactive
      Avoid prompting the user for input of any kind.  If a
      password is required for the command to run, sudo, will
      display an error message and exit.
    

    It’s just a nice thing to put in non-interactive scripts that use sudo. Sometimes you can end up with scripts that just wait endlessly for a password that will never be input because the script is being run non-interactively. The flag probably isn’t needed for a cron job, because root probably can sudo as any user without a password, but it doesn’t hurt either.

    EDIT: I didn’t know that there are user crontab entries as well. If you just used crontab -e without using sudo, then you don’t need to worry about the job being run as root.

    • imminent_nebula@lemmy.caOP
      link
      fedilink
      arrow-up
      1
      ·
      3 hours ago

      This was really interesting, thanks. Something I’ll keep in mind for sure, but I did set it up with crontab -e so maybe I’m all good. Gonna play around with it some more over the next few days, there’s so much to learn. Linux is amazing