Unfortunately no one can be told what fun_plug is - you have to see it for yourself.
You are not logged in.
just thought i'd give it...
if anyone can find a way for it to automatically select a port, lemme know. it's been a while since i wrote shell scripts.
Usage: run_torrent.sh <port> <torrent>
Ex. run_torrent.sh 6881 Various_Artists_-_Music_Album.torrent
#!/bin/sh # # DSM-G600 ctorrent running script v1 # # ############################################################### # CONFIGURATION SECTION ############################################################### # # Set 'auto_detect_ip' to 1 to automatically attempt to find # the DSM-G600's IP address # Or set it to 0 and configure the local IP address manually # by modifying local_ip to your static IP. # auto_detect_ip=1 local_ip="192.168.1.100" #Unimplemented #auto_detect_port=1 ############################################################### # DO NOT MODIFY ANYTHING BELOW THIS LINE ############################################################### if [ ! $2 ] then echo "Usage: $0 <port> <torrent>" return fi if [ $auto_detect_ip -eq 1 ] then ifconfig_text=`/sbin/ifconfig` #echo $ifconfig_text local_ip=${ifconfig_text#*eth0 *inet addr:} local_ip=${local_ip%% *} fi local_port=$1 #Code for auto-detecting port here echo "Running torrent $2 on $local_ip:$local_port" #echo "nohup ctorrent -e 0 -C 4 -i $local_ip -p $local_port \"$2\" > $2.out &" nohup ctorrent -e 0 -C 4 -i $local_ip -p $local_port "$2" > $2.out &
This script provides a way to automatically set the IP address, i'd also like a way to automatically set a port.
The only way I can think of automatically finding an open port is to:
1) have the user fill an array with the ports he/she has opened up on their router
#auto_detect_port=1 #valid_ports={6881 6882 6883 6884 6885 6886 6887 6888 6889}
2) capture the text from the "ps -e" command, then extract each line with ctorrent in it and extract the port number
ps_text=`ps -e`
3) Remove each of those ports from the array of user selected ports,
?? anybody ?
4) Then if there are any ports left in the array, pick one and run the torrent using it, otherwise error out.
?? :-) again, anybody?
someone wanna script that up for me?
it's been ages since i've used arrays in linux shell scripts.
thanks,
Offline
I tried your script but I noticed that if I run ctorrent with nohup, it uses 99% CPU. However, if I don't run ctorrent with nohup then the CPU usage is less than 1%.
Is there anyway to run cturrent with nohup without using 99% CPU?
Offline
nohup is writing output to somewhere in real-time, you may try to sent output to /dev/null
This may help.
Offline