Search code examples
pythoncroncron-tasktransmissiontorrent

adding magnet links from cron job


I have a piece of python script which puts magnet links in transmission. Now when I run it through terminal it runs ok, opens transmission if closed and adds the torrent/s. Now when I put it in a cron, transmission doesn't open but I know that the cron is running because it writes to a text file the name of the file which is being added.

def download_movie(magnet_link):
    os.system('transmission-gtk ' + magnet_link)

As you can see the code is pretty simple and just invokes transmission and passes the magnet link. Thank you.


Solution

  • Altough resons for this may vary, what solved the issue for me most times was logging in as superuser and then do the cron. If that does not work additional information would be needed, so consider also posting the log. It should be in /var/log/syslog.

    What might help, too is setting an absolute path for python: Instead of python write the full path, normally /usr/bin/python+yourVersionNumber