LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 06-16-2011, 02:20 AM   #1
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Rep: Reputation: 5
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?
 
Old 06-16-2011, 03:33 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

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

Code:
#!/bin/bash
/usr/bin/ktorrent --silent "$*"
Evo2
 
Old 06-16-2011, 07:04 AM   #3
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Original Poster
Rep: Reputation: 5
Quote:
Originally Posted by evo2 View Post
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
 
Old 06-16-2011, 07:19 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and Scientific Linux
Posts: 5,753

Rep: Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288Reputation: 1288
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.
 
Old 06-16-2011, 07:24 AM   #5
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 262

Original Poster
Rep: Reputation: 5
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
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
SSH connection from BASH script stops further BASH script commands tardis1 Linux - Newbie 3 12-06-2010 09:56 AM
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 10:42 AM
Opening and saving an image file in a bash script Dralnu Programming 5 06-16-2009 02:23 PM
Opening a nautilus via a bash cron script rose_bud4201 Programming 3 06-20-2008 10:26 AM
opening new bash tabs or consoles from a script Nice-n-Slow Programming 7 07-12-2004 10:25 AM


All times are GMT -5. The time now is 04:26 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration