How many users on router? run torrent

I share my router and I have "off-peak" internet time 2am to 8am - I needed a script to see if I am the only user on-line so that my torrents don't suck up the other people's bandwidth...
This works:
#!/bin/bash
# should torrent run?
# using a router shared by a number of people
# If I am the only user or it is off peak time (or other concerns) then decide whether to run torrent
#functions
# check who's online
function checkingprocess {
# start by saying there are zero users
homeusers="0"
echo "home users reset to zero"
# nong (important other user) is not on
nong="no"
echo "nong set to no"
# get the file with MAC addresses of people connected to wireless router
wget http://192.168.1.1/wlclientview.cmd --http-user=USERNAME --http-password=PASSWORD
echo "got list"
mv ~/wlclientview.cmd ~/mybin/whoosonline
echo "moved list"
# check if others are on-line
homeusers=$(grep -c "<tr>" ~/mybin/whoosonline)
echo "counted $homeusers table rows"
# remove extra 3 that are not useful
homeusers=`expr $homeusers - 3`
echo "that means we have $homeusers users (result -3)"
# check for special case "nong"
if grep -q "MAC:OF:USER:NONG" ~/mybin/whoosonline
then
# special case - Nong is online too
nong="nong"
echo "nong online"
else
echo "nong not on line"
fi
# report total to text file for conky to display
echo $homeusers > /home/tawan/mybin/whoosonlinenow
# check the time
function timechecker {
# off-peak internet use between 3 and 6 am
# actually 3 to 8 but give others a chance early morning from 6
TIME=`date +%H`
if [ "$TIME" -ge "02" ]
then
mytime="offpeak"
echo "off peak time?"
if [ "$TIME" -le "05" ]
then
mytime="offpeak"
echo "off peak time"
else
mytime="peak"
echo "peak time"
fi
else
mytime="peak"
echo "peak time"
fi
# run
function myrunner {
ps aux > /tmp/ps.log
# look in the file for this name to see if it is running
if grep rtorrent /tmp/ps.log
then
appcheck
if [ "$appkill" -ge "1" ]
then
echo "can't run torrent $appkill x web app open"
else
echo "torrent already running"
fi
else
echo "run torrent"
appcheck
if [ "$appkill" -ge "1" ]
then
echo "can't run torrent $appkill x web app open"
else
urxvt -g 46x1 -title rtorrent -e rtorrent -o http_capath=/etc/ssl/certs &
fi
fi
# kill
function mykiller {
ps aux > /tmp/ps.log
# look in the file for this name to see if it is running
if grep rtorrent /tmp/ps.log
then
killall rtorrent &
fi
echo "kill torrent"
# app check
function appcheck {
appkill="0"
# skype - kill torrents if skype in use
myapp="skype"
appkiller
# chromium - kill torrents if chromium in use
myapp="chromium"
appkiller
# firefox - kill torrents if firefox in use
myapp="swiftfox"
appkiller
# app killer
function appkiller {
if grep $myapp /tmp/ps.log
then
mykiller
echo "killed because of $myapp"
appkill=`expr $appkill + 1`
fi
# think about it all
function mythinker {
# in peak time we run if you are the only user
# in off peak time we run even with other users
# unless that user is nong and so we kill later
# always kill if nong is on-line
if [ "$nong" = "nong" ]
then
echo "nong on-line so kill torrent"
mykiller
else
if [ "$mytime" = "offpeak" ]
then
echo "....off peak time. Let's run torrent"
myrunner
else
if [ $homeusers -le 1 ]
then
echo "....peak time and think only user is you so run torrent"
myrunner
else
echo "....peak time and other users on-line so kill torrent"
mykiller
fi
fi
fi
#end functions
#loop
while [ 1 ]
do
echo "start of loop"
# run the above functions and loop
checkingprocess
timechecker
mythinker
echo "done functions, will sleep"
sleep 20s
echo "end of loop"
done
#end loop
edit : improved
Last edited by tawan (2010-07-25 07:05:20)

QoS means Quality of Service.  Basically it reorders or delays packets depending on priority, so that time-sensitive packets always go first, and unimportant packets like bittorrent can be delayed until there is no other traffic being sent.  What I specifally was suggesting here is that your use it to lower the priority of bittorrent traffic, so that you can run it all the time but it only uses spare bandwidth that isn't being used by any other service.
The only catch most routers can only do QoS on inbound connections which is mainly helps latency and not download speeds.  However, if your router is running linux it may have that ability.  Also look for the 'tc' utility or maybe you can install trickle.
This thread has little bit more info.
Last edited by xenobrain (2010-07-20 14:11:50)

Similar Messages

  • How many times should I run the APPLE TEST HARDRIVE/DRIVE on my macbook?

    how many times should I run the APPLE TEST HARDRIVE/DRIVE on my macbook?

    Do you mean your hardware tester or Disk Utility?
    -Bmer
    Mac Owners Support Group - Join us @ MacOSG.com
      Mac611 Mobile Mac Support - about.Mac611.com
       iTunes:MacOSG Podcast | YouTube.MacOSG.com
                       An Apple User Group 
    Have an iPhone or iPod touch? Enter Mac611.com in Safari on it for 'mobile Mac support.'

  • How many users can 1 Xserve support?

    I have one Xserve (10.5.2, 2x3GHz, 5GB RAM, 1.34TB RAID 5) that I want to support the following services for my SMB:
    DNS, DHCP
    AFP, NFS, SMB
    Open Directory
    Print
    Software Update
    I also want to have mobile sync'd network home folders, but only for ~/Documents and iCals and Address Books (I don't want everyone's MP3s or family photos).
    I occasionally will use NetBoot/NetInstall, but only 1-2 users at once.
    I am getting ready to migrate my company to OpenDirectory and 10.5.2 for all users and was hoping someone here might be able to tell me how many users I can reasonably support with one Xserve.
    Also, is it a bad idea to have everyone using "mobile" accounts? It seems like it would be less strain on the server to have the occasional sync from users than everyone reading & writing all the time. Also, if anything happened, there would be a local copy and a remote copy of any files.
    Thanks.

    Rosemarie,
    BeehiveOnline currently supports 95,000 users and we have groups on the system as large as 10,000, that is probably about as big as we want to go - remember collaborating with 10,000 users is not an effective way of working - maybe a more open way of delivering content may be more appropriate. Given that the only issues we have with very large groups is the time it takes to run and the email traffic it generates as the large group are processed.
    So it is possible to host 10,000 in a group but we need to be warned in advance and work with you to minimise the impact as the group is set up.
    Phil

  • How to see how many users are working on a Dynpro application?

    Hello,
    Is it possible to see somwhere at the portal or on the WAS how many users are currently working with my Web Dynpro application?

    Hi Roy,
    I know it isn' exactly what you want but if you got to:-
    System Administration->Support->Web Dynpro Test Tools->User Management
    you can at least see the users currently running Web Dynpro applications (I think!)
    At least its a start!
    Cheers,
    Gareth.

  • How many users can connect to a shared drive on a non-server workstation?

    How many users can connect to a shared drive on a non-server workstation? We're waiting for our server to arrive and in the interum we're using a Pegasus 2 R6 attached to an iMac running Mavericks as our fileserver. It's been sketchy, the connection to the server being dropped once in a while or the inability to mount the drive after a week of success. The Pegasus we're using now will be attached to a server once it arrives. For now I need to figure what's coausing trouble before I commit to this being our main storage as planned. The data is backed up every night so I'm not worried, its the usability issues. 5-7 people are mounting this drive and opening/saving at the same time. Is there a limit to Maverick's fileserving ability that may be causing this? Understandable if so.

    The file server in the client version of OS X has a default limit of 10 simultaneous connections. That limit can be raised by installing OS X Server, or lowered by setting a hidden preference. Assuming you've done neither, you may be able to solve the problem temporarily by stopping and restarting file sharing in the Sharing preference pane, or permanently by setting another hidden preference on the server to break idle connections quickly.
    defaults write /Library/Preferences/com.apple.AppleFileServer idleDisconnectOnOff -bool YES
    Stop and restart file sharing. To reverse the change, run this command in the same way:
    defaults write /Library/Preferences/com.apple.AppleFileServer idleDisconnectOnOff -bool NO
    Credit for this solution to ASC member suter:
    this file server will not allow any additional users to log on

  • How many users on Mac Mini Server?

    Good morning,
    Apple's recent changes to the Mac Mini line have thrown a wrench in a project plan I've been working. One part of the project needs a quad-core computer (FileMaker Server) and so I'm having to either search for an older model or switch up to a Mac Pro.
    The other part of the project involves bringing a Mac-based server in for directory and user services, including mail.  I had planned to use the high-end Mac Mini Server but that option was removed. The office I'm supporting is about 15 people (usually a little less on the network) and most of their work will actually be done against the other computer running the FileMaker Server-based application. I was not expecting a big load against the Mac Mini Server. But these changes got me wondering, what are others' experiences with Mac Mini as a server for 12-15 people? I'm happy with qualitative and quantitative data, but I would like to know which is which. In general:
         For how many users have you provided directory and user services (built in to the OS) using a single Mac Mini?
         What were the specs of the Mac Mini (year or model, speed, CPU config, RAM)?
         Other thoughts?
    In essence, I need to understand if people have successfully used dual core processors as Mac Mini servers in environments of 12-15 people. I've done it using a 2012 Mac Mini Server with 5-6 and the loading seems to support further growth, but would like real-world experience.
    Thanks.

    Dutch Apple employee told me that Mac OS X 10.6 Server has also Windows Terminal Services equivalent.
    But this is not !
    Not yet (?) available in Snow Leopard Server.

  • How many threads can be running at the same time

    Hi!!
    Dows anyone knows how many Threads can be running at the same time in the JVM.
    I'm making a multi thread client-server app and I would like to know how much simultneous connections the JVM support. I'm using one Thread per connection.

    Hi, thanks to all for your answers.
    I think that I made the wrong question, as you said: "that means the number of threads currently created".
    I'm worry about this because my application is already online (It's a mail server -SMTP and POP3 server using ORACLE for the users database- ) and some other user post in the "multi-tread forum" that almost any JVM can only have 700 threads created at the same time, and I've never heard or read anything about this.
    what you mean with the stack space (memory??)
    I'm using the JavaWebServer 2.0 and a servlet to start the main Thread.
    Again Thanks to all for the answers but I think that the schapel answer is the one that solve my doubt...

  • Find how many users are connected in the Oracle Server

    Hi,
    I am using Oracle 10g. My question is, is it possible to find how many users are connected in the Oracle Server. We are having one Server and we are having many client machines which will connect the Oracle.
    And one more question in the meanwhile i want to take Backup of one database which client as connected. Is it get any problem to the client machine which is accessing the server. And How to take the backup from the server machine. Any commands to process.
    Thank u...!

    Hi there.
    If You run
    select count(*) from v$session where username is not null;you'll get the number of users connected to Oracle server,
    and yes , you could do backup while users are connect to db you are backing up.
    cheers

  • Ldap - how to check how many users are connected?

    Hi Guys,
    Please help me.
    We have iPlanet installed using LDAP. I want to check in ldap console that how many users are connected currently and monitor that.
    please tell me how can i do it
    thanks

    Hi Noor,
    Thank you for posting in Windows Server Forum.
    From your description I can understand that you want the user name with app they have in their session.
    You can achieve with below command.
    Query process User name
    Displays information about processes running on a terminal server. You can use this command to find out which programs a specific user is running, and also which users are running a specific program.
    More information:
    Query process
    http://technet.microsoft.com/en-us/library/bb490798.aspx
    Hope it helps!
    Thanks.
    Dharmesh Solanki

  • I want to check that how many users are connected to the wifi which i m using at present

    i want to check that how many users are connected to the wifi which i m using at present???

    Go to Utilities > Airport Utillity
    If you click on your router it should show you the "wireless clients" that are connected

  • Movement Type used for How many users

    Dear All,
    I need to check how many users having authorization of "311" Movement Type. How i can check it?
    Thanks & Regards,
    Pramod

    These are the authorisation object which consists of authorisation field BWART(Movement type)
    M_MRES_BWA Reservations: Movement Type
    M_MSEG_BMB Material Documents: Movement Type
    M_MSEG_BWA Goods Movements: Movement Type
    M_MSEG_BWE Goods Receipt for Purchase Order: Movement Type
    M_MSEG_BWF Goods Receipt for Production Order: Movement Type
    You can run t-code SE16> Goto Table AGR_1251> In Field textbox enter BWART-->Low textbox Enter the value(311).
    You will get list of roles. Copy those role and then Goto se16>AGR_USERS>In AGR_name textbox Multiple selection paste these role names.
    You will get list of user having access to those roles.
    Do let me know if this brings the data what is required.

  • Determin how many user log on the site using JSP/Servlet?

    Hi all,
    Is there a way to determine how many user log on the site using JSP/Sevlet? I'm running Apache 2.x & Tomcat 4.x
    I'm trying to get a list of user currently log in the site.
    Please help!
    Thanks,
    -JN-

    You could use the HttpSessionBindingListener interface. Every time a user logs into the session put a user object into the session. The user object will implement the HttpSessionBindingListener interface. When the user object is added to a sessiion it recieves an event and it increments a counter. When the session times out or you invalidate the session because the user has logged out the user object will recieve an event and it can then decrement the counter.
    This will at least tell how many active user sessions there are.

  • How many users can you have on one account ?

    Hi,
    I have just created a ID with Adobe Reader for a group to use files stored in cloud. I would like to know how many users can access the account at one time via, mobile devices, ipad, desktops ?

    I don't know if there is a limit; you do mean the free https://cloud.acrobat.com/ ?
    I will move your post to the Acrobat.com forum, where someone hopefully can give you a definitive answer.

  • How to know how many users uses Report Designer?

    Dear Experts,
    Somebody knows if it's possible to know how many users have made look ups in Report Designer on one period or how many modifications?
    Thanks in advance.

    Hi,
    If the cube is checked for Statistics, there is a option settings for BI Statistics under tools, then all the user related info is stored in Techincal Content Cubes. Based on TCT(technical Content Cubes), you need to create a report based on the requirement. From then we can know user log info for the particular queries.
    Hope this helped you
    Thanks
    PT

  • How many devices can i run lion on it?

    how many devices can i run lion on it?

    As far as licensing goes, it seems that as long as all the Macs are being used in your household, there's no limit.
    From the Lion license file:
    "If you obtained a license for the Apple Software from the Mac App Store, then subject to the terms and conditions of this License and as permitted by the Mac App Store Usage Rules set forth in the App Store Terms and Conditions (http://www.apple.com/legal/itunes/ww/) (“Usage Rules”), you are granted a limited, non-transferable, non-exclusive license:
    i) to download, install, use and run for personal, non-commercial use, one (1) copy of the Apple Software directly on each Apple-branded computer running Mac OS X Snow Leopard or Mac OS X Snow Leopard Server (“Mac Computer”) that you own or control."

Maybe you are looking for

  • MacBook Pro DVI-HDMI 1080p doesn't work correctly

    Hello, I've just bought new Samsung LCD TV LE40B550. This TV is Full HD and support 1080p. I've connected it via DVI (macbook pro) -> HDMI (TV) cable. It works ok, when I set 1080i. But when I set up 1080p, it shows few dots (pixels) on TV not correc

  • Usb audio out from airport express

    Hi, If I want to put a DAC with USB input between Airport Express and my stereo, will I be able to do so?  I'm thinking about using the NuForce Icon-2 DAC.  So Itunes>>Airport Express>>NuForce DAC>>stereo receiver. Thanks in advance, Dave

  • File created in 6.5.2 on MacBook won't open in 6.5.2 on iMac

    Nothing I create on my MacBook in any of the iWork apps will open in the same version on my iMac. Yosemite on both computers, same software versions on both computers. Anyone else having these issues?

  • How do extract one page from one pdf document and save as a new pdf?

    How do I extract one page from a pdf document and create a new document?

  • G5 with issues

    Hi - I have lots of niggles and a general sense of things 'not being right' on my 'puter. e.g. Apps freezing and hanging (particularly in iLife '08) sometimes my cursor becomes the beachball, but not spinning - and it still functions when used to poi