LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
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, 01:20 AM   #1
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 271

Rep: Reputation: 6
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, 02:33 AM   #2
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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, 06:04 AM   #3
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 271

Original Poster
Rep: Reputation: 6
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, 06:19 AM   #4
evo2
LQ Guru
 
Registered: Jan 2009
Location: Japan
Distribution: Mostly Debian and CentOS
Posts: 6,724

Rep: Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705Reputation: 1705
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, 06:24 AM   #5
Adol
Member
 
Registered: Feb 2011
Location: Osaka, Japan
Distribution: Gentoo, Opensuse
Posts: 271

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



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 08:56 AM
bash `kill`: process 'B' silently dies; but process 'A' = `kill` spews back debris! GrapefruiTgirl Programming 9 06-23-2009 09:42 AM
Opening and saving an image file in a bash script Dralnu Programming 5 06-16-2009 01:23 PM
Opening a nautilus via a bash cron script rose_bud4201 Programming 3 06-20-2008 09:26 AM
opening new bash tabs or consoles from a script Nice-n-Slow Programming 7 07-12-2004 09:25 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 02:47 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
Open Source Consulting | Domain Registration