Yeah, a command line tool for monitoring the internet usage so that I can avoid over usage of the internet. This was something that I have been trying to develop for quite sometime and the breakthrough happened just yesterday. Initially I was trying to develop it using shell scripts. The whole script was centered at the ifconfig command. When I tried installing it to the crontab, it won't work for some reason which I don't know yet. Then I turned to Python. Here too the script was centered on the ifconfig. But to my disappointment that too didn't work when installed to crontab. it was at this point that I thought about a different strategy. In order to get the details of Internet usage in current session I decided to rely on the file, the ifconfig command is relying rather than the relying on ifconfig command itself.
So the next challenge was finding out the file ifconfig is relying. Then I decided to analyse the system calls used by ifconfig . Here I took the help of strace command and arrived at the conclusion /proc/net/dev is the file that is used by the ifconfig for the details of internet usage in current session. And with this file things become lot easier.
As of now this application will monitor the usage for one month. Then it is reset to zero automatically. You can change the day of the month in which the monitoring begins. The application also has a feature wherein you can set free usage time, so that the internet usage is not monitored between the specified time.It can only monitor the internet communication taking place through eth0 (wired) eth1 (wireless) interfaces.
You may track the development here. You can install it by running Installer.sh script (Don't change the file names and all files should be in the same directory as of Installer.sh ). After installing you can use the tool by using the command Eusage along with the switches.
Note : Scripts won't work without running Installer.sh. Don't try to run Eusage without the switches
Eusage -u :- used to give the details of usage so far, from the beginning of the month
Eusage -r :- To clear the memory (i.e. everything will be set to zero)
Eusage -h :- for help
Eusage -c :- for changing free usage time and to set the day of month to begin the monitoring
Showing posts with label Application. Show all posts
Showing posts with label Application. Show all posts
Sunday, January 22, 2012
Command line tool for Internet Usage Monitoring in Linux
Labels:
Application,
Linux,
Python
Wednesday, June 08, 2011
Laptop Battery Monitor Application
I made my own battery monitor application. What prompted me to make my own application for this purpose is that I found the inbuilt battery monitor display of my OS (kubuntu10.10) is not satisfying my needs. In order for my OS battery monitor to display the remaining percent of charge , I've to get the cursor over the battery monitor icon. I found this procedure as unsatisfying. So I thought of making my own application using bash script. I wrote a bash script for this purpose and then I made it as a crontab entry, so that it gets executed every minute. My application actually uses the Advanced Configuration & Power Interface(acpi) utility.
The above picture actually shows my desktop panel in the top. The green blur (Sorry for that)text in that picture shows the percentage charge remaining in the battery. Also it changes its colour depending on the amount of charge remaining.
Here is the script :-
Here is the script :-
Labels:
Application,
Bash
Subscribe to:
Posts (Atom)