LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Bash script for opening ktorrent silently (https://www.linuxquestions.org/questions/linux-newbie-8/bash-script-for-opening-ktorrent-silently-886649/)

Adol 06-16-2011 01:20 AM

Bash script for opening ktorrent silently
 
Hello,

I'm trying to write a simple bash script but seem to be getting something wrong.

The bash script is to open ktorrent silently and load torrent files with no prompt. I cannot updgrade ktorrent because my tracker only supports my current one.

Here is the bash script I'm trying to use:

Code:

#! /bin/bash
# script to start torrent files silently
/usr/bin/ktorrent --silent

I chmoded it with 700 so it can run but its not doing what I want. I set the .torrent association to use this bash file. Its run as bash /*/*/ktorrentsilent

Any ideas?

evo2 06-16-2011 02:33 AM

I guess you need to pass it the file name. The following should work:

Code:

#!/bin/bash
/usr/bin/ktorrent --silent "$*"

Evo2

Adol 06-16-2011 06:04 AM

Quote:

Originally Posted by evo2 (Post 4387249)
I guess you need to pass it the file name. The following should work:

Code:

#!/bin/bash
/usr/bin/ktorrent --silent "$*"

Evo2

Thank you. I'm a little further

now I'm getting this error:

Code:

ktorrent is already running !
Its trying to open ktorrent instead of adding a torrent file:(

evo2 06-16-2011 06:19 AM

Looks like you've met a limitation of ktorrent. I don't use ktorrent had a quick google and it seems you can specify a directory that it can watch for new torrents which it will automatically load. So I guess you need to do two things;


1. Modify your script to move the torrent file instead of running ktorrent
Eg.
Code:

#!/bin/bash
mv "$*" ~/torrent-autoload/

2. Configure ktorrent to look in a specific directory for new torrent files (probably in some configuration gui)

In this scenario you need to start ktorrent manually, or you could add one more line to the script to try to start ktorrent.

Cheers,

Evo2.

Adol 06-16-2011 06:24 AM

Got it running.

When I typed the torrent file in manually it told me that Ktorrent was already open but it doesn’t matter. It opens and starts the torrent file.

My problem was simple. On the file association I missed a letter in my bash script path.

Working perfectly now.

Also, Thank you evo2


All times are GMT -5. The time now is 10:57 AM.