rTorrent control using web server

5 views
Skip to first unread message

Rishab Arora

unread,
Jun 3, 2011, 12:08:32 PM6/3/11
to iit...@googlegroups.com
Hi All,
I'm trying to build a web based interface to pause rtorrent on my Ubuntu Server for 30 minutes every time a person clicks a button.

I'm trying to build this so that my neighbour (who shares my net connection) or any other member of my family can surf the web without rtorrent hogging up all the bandwidth. But they can't handle an ssh connection.

This is what I've done so far:

A python cgi script is executed on clicking a link and then,
- If rtorrent is not running, it does nothing
- If rtorrent is running, it executes "kill -2 'pid'" and then "sleep 1800;screen -d -m rtorrent"

This actually does the job.
The problem with my solution is that the rtorrent process then needs to belong to the user "www-data" for apache to be able to kill it.

And if this happens, i can't access the screen executing the rtorrent, and hence, cannot monitor my downloads.

Any suggestions?

--
Rishab Arora
####
If the world were a linux terminal
http://www.arthiktangi.com/?p=391
####

satyaakam goswami

unread,
Jun 3, 2011, 1:34:02 PM6/3/11
to iit...@googlegroups.com

run rtorrent as www-data user or add a sudo rule with the command for your user

-Satya

Rishab Arora

unread,
Jun 3, 2011, 2:01:23 PM6/3/11
to iit...@googlegroups.com
Running as www-data gives the problem that I cannot open the rtorrent screen to check on my downloads. It works this way already. But I need to be able to access that screen.

Giving www-data permissions to kill a process would only solve a part of the problem.

Is there a way www-data could execute rtorrent as my user in the script?


 
Rishab Arora
####
If the world were a linux terminal
http://www.arthiktangi.com/?p=391
####

--
Mailing list guidelines and other related articles: http://lug-iitd.org/Footer


Himesh Madhusoodanan

unread,
Jun 3, 2011, 3:18:43 PM6/3/11
to iit...@googlegroups.com
I think you should have your user own the cgi-script and then configure Apache ( i assume ) with suEXEC to execute the script as the user instead of www-data. Since your script should now be running owned by the user it should have no problem accessing your rtorrent owned by the same user, then you can also monitor the download status. Hope this helps


Himesh. 

Rishab Arora

unread,
Jun 3, 2011, 6:54:43 PM6/3/11
to iit...@googlegroups.com
Exactly what I need :) Thanks!
Rishab Arora
+91 9818130327
Reply all
Reply to author
Forward
0 new messages