This forum has been archived. All content is frozen. Please use KDE Discuss instead.

Shell script to control KT

Tags: None
(comma "," separated)
George
Moderator
Posts
5421
Karma
1

Shell script to control KT

Sat Jun 03, 2006 8:42 am
Adam Forsyth aka phantom042 has put together a little script to control KT from the console. You need the latest code from SVN to make it work.

You can find the script here :

http://ktorrent.org/downloads/ktshell.sh

We will include it with the next release (still need to add it to the SVN repository).

A big thanks to Adam, for contributing this, and if there are any bugs in it, just post them here.

Last edited by George on Sun Nov 02, 2008 9:25 am, edited 1 time in total.
agforsyth
Registered Member
Posts
133
Karma
0

Sat Jun 03, 2006 8:38 pm
I'll send in a new version with better automatic detection of dcop servers as soon as I finish testing it.
George
Moderator
Posts
5421
Karma
1

Mon Jun 05, 2006 8:24 am
Updated version of the script :

http://ktorrent.org/downloads/ktshell
GiB
Registered Member
Posts
3
Karma
0

Recycling KT to aleviate thrashing

Fri Jun 30, 2006 2:16 am
It really grieves me that KT (ktorrent_2.0beta1-1_i386.deb) performs so badly, crashing often, saturating my ADSL link (but achieving a mere average ~25KB/s effective DL rate out of my available ~90KB/s), losing responsiveness often (taking 100% CPU), thrashing, occasionally filling my swap space (1G), fluctuating memory consumptions (top shows 140 to 730MB virtual; leaking?!)...

In my recent experience KT usually (not always) starts sane and goes nuts with time. (The log didn't help me understand anything.)

To prevent KT from burning my HD (due to thrashing) I resorted to "recycling" it, automatically, since can only use it when leaving home. Eg:
Code: Select all
#!/bin/bash
# recycle-ktorrent.sh: recycles KTorrent every 3 hours... :o(

while true
do
   ktorrent
   sleep 10m
   dcop ktorrent KTorrent startAll 3
   sleep 3h
   dcop ktorrent MainApplication-Interface quit &
   sleep 10m
   killall ktorrent
   sleep 10m
done


phantom042's meticulous (if uncommented) script should be studied to enhance this Q&D one...

HTH someone. (Better, I hope we won't need this ugliness, soon.)
(o;
George
Moderator
Posts
5421
Karma
1

Sat Jul 01, 2006 9:52 am
The beta had some problems, but I haven't heard anything this bad.

Have you tried a recent SVN version like this one :

http://ktorrent.org/downloads/svn-snaps ... -06.tar.gz

From a couple of hours ago.
jdong
Registered Member
Posts
358
Karma
0

Mon Oct 02, 2006 3:52 pm
ktshell should explicitly use /bin/bash as its interpretor, as it uses some bash-specific extensions. It doesn't run with /bin/dash or other sh-compatible replacements that distros may be using. Namely, Kubuntu Edgy will be using dash as the default sh.

It would be nice if that could be worked into a 2.0.3 release, too.
George
Moderator
Posts
5421
Karma
1

Mon Oct 02, 2006 4:48 pm
No problem, allready done
k2
Registered Member
Posts
7
Karma
0

Thu Nov 30, 2006 4:07 pm
Code: Select all
jrodman@Skonnos:~> ktshell
Looking for DCOP servers...
ERROR: Unsupported option (BSD syntax)
********* simple selection *********  ********* selection by list *********
-A all processes                      -C by command name
-N negate selection                   -G by real group ID (supports names)
-a all w/ tty except session leaders  -U by real user ID (supports names)
-d all except session leaders         -g by session OR by effective group name
-e all processes                      -p by process ID
T  all processes on this terminal     -s processes in the sessions given
a  all w/ tty, including other users  -t by tty
g  OBSOLETE -- DO NOT USE             -u by effective user ID (supports names)
r  only running processes             U  processes for specified users
x  processes w/o controlling ttys     t  by tty
*********** output format **********  *********** long options ***********
-o,o user-defined  -f full            --Group --User --pid --cols --ppid
-j,j job control   s  signal          --group --user --sid --rows --info
-O,O preloaded -o  v  virtual memory  --cumulative --format --deselect
-l,l long          u  user-oriented   --sort --tty --forest --version
-F   extra full    X  registers       --heading --no-heading --context
                    ********* misc options *********
-V,V  show version      L  list format codes  f  ASCII art forest
-m,m,-L,-T,H  threads   S  children in sum    -y change -l format
-M,Z  security data     c  true command name  -c scheduling class
-w,w  wide output       n  numeric WCHAN,UID  -H process hierarchy
There is no DCOP server running.


Well, it's true I do not have a DCOP server running, but i think something went wrong in there. This is "my fault" for the following:

jrodman@Skonnos:~> env |grep BROKEN
I_WANT_A_BROKEN_PS=hi

Still, I wonder if the script could be made to work regardless by supporting BSD syntax. Oh, duh, another option is to just remove this variable (if present) in the script's environment.
TorrentialStorm
Registered Member
Posts
11
Karma
0

Thu Nov 30, 2006 5:28 pm
all i get is:

Looking for DCOP servers...
Found a DCOP server.
Cannot connect to the DCOP server.
:(
Luzbel
Registered Member
Posts
1
Karma
0

Tue Jan 02, 2007 12:46 pm
TorrentialStorm wrote:all i get is:

Looking for DCOP servers...
Found a DCOP server.
Cannot connect to the DCOP server.
:(


I'm getting the same trying to run from ssh. It works like a charm locally.
jdong
Registered Member
Posts
358
Karma
0

Thu Jan 04, 2007 7:01 pm
I've had this happen a few times too. Connecting to dcop from a different login session of the same user isn't 100% reliable.
seezer
Registered Member
Posts
2
Karma
0

Thu May 03, 2007 11:48 am
If you can't connect to dcop server even if the dcop server is running, check your DISPLAY environment variable - set it according to your X-Setup.
export DISPLAY=:0 should help in many cases .
This makes it possible to use it remotely via ssh.
johnjaylward
Registered Member
Posts
63
Karma
0

Tue Feb 17, 2009 5:08 am
does this still exist in 3.x branch, or was it lost in the 2.x code?
dimanish
Registered Member
Posts
6
Karma
0

Tue Feb 17, 2009 10:49 am
johnjaylward wrote:does this still exist in 3.x branch, or was it lost in the 2.x code?

There is no ktshell for 3.x because it works with dbus, not dcop like in 2.x. So if you wish you can rewrite ktshell script for 3.x with dbus. :)
agforsyth
Registered Member
Posts
133
Karma
0

Tue Feb 17, 2009 8:43 pm
Just use the web interface. Or DBus, if you really want to do it command line style.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Google [Bot], Sogou [Bot]