Ubuntu :: Creating Script For Calculating Payments
Jul 16, 2010
Recently I was trying to make a quick script for calculating payment between workers. I got stuck however. Here is what I am in for...
#!/bin/bash
#Setting the calculator
calc=` bc << EOF
scale=4
a=$2*($3/100)
b=$4
a/b
EOF
`
I've saved the $1 for further script.
#Creating the script
while [ -n $1 ]
do
case $1 in
workerA) read -p "Enter the total sum: " total
total=$2;
read -p "Enter the percentage:" percent
percent=$3;
read -p "Enter number of workers:" workers
workers=$4 ;;
*) echo "Error usage!"
break
esac
done
My script ends here. It just does not work. Did I sat the vars in the wrong way?
View 5 Replies
ADVERTISEMENT
Jun 22, 2010
Currently using linux mint.While it's nice I have the feeling all those bells and whistles must be exposing a large attack surface. What is the most secure distro known to man, but which is still capable of making payments to amazon and ebay?
View 14 Replies
View Related
Feb 21, 2011
I have read many articles on hdparam to calculate the disk read and write speeds and some on interface and CPU limits. But is there a structured way of calculating the maximum throughput of a server including all the subsystems. Like storage, CPU, network, memory and so on? So that I can create a script that i can run on a newly installed Linux machine and calculate the maximum throughput .
View 4 Replies
View Related
Oct 4, 2010
calculating the IOPS for my system ?I had understood that IOPS could be calculated by monitoring IOSTAT. The r/s (reads/sec) and w/s (write/sec) combined basically gave you the peak IOPS.However having monitored iostat for my app during a performance test, the figures I'm seeing lead me to believe that iostat couldn't be a reliable way to calculate IOPS. I get values of over 10,000 for w/s! I didn't think this was possible given the storage system i have (4 x 7500rpm sata disks in raid 5).
View 1 Replies
View Related
Jan 27, 2010
With array in php. All I was having the following columns:
Code:
Now Like the Above there were more variables defined through script:
Code:
Now what the above code is doing is calculating average of above values from columns{1-?,4-?)..likewise
Say If I remove two Machine and calculate the avg.
View 1 Replies
View Related
May 13, 2010
What originally seemed like an easy thing to calculate has given me a big headache. Perhaps someone can help me with my issue. I am trying to find, in particular, how much memory certain application processes are taking. The process always is the same name, main_server, but with an argument to tell it what to do when running as a daemon.
When running the following command against all "main_server" processes, it produces a result in megabytes based on the output of the rss field in 'ps'.
Code:
CALC=0
for ea in
`ps -e -orss=,args= |
sort -b -k1,1n |
pr -TW$COLUMNS |
grep main_server |
grep -v "grep main_server" |
[Code]...
Currently I am left scratching my head. For capacity planning purposes, it would be nice to know how many more 'main_server' processes could run on the system without causing it to swap. Knowing the buffer and cache usage will go down as running processes demand more memory, I prefer to look at the free memory excluding cache and buffers. However, since 'ps' is reporting the processes are using more memory than free reports is in use without those things, I have no way to know how many more processes the system can support. I played around with different fields in 'ps', such as vsize, size, etc, but with no luck in matching up any numbers.
View 7 Replies
View Related
Feb 17, 2010
I'm trying to create a script that will find the bandwidth usage of certain protocols only. For example, SMTP. I would like it to just return a number. Is there a known command/parameters to output something like this?
View 2 Replies
View Related
Apr 25, 2010
I'm trying to write a python script that will calculate my test scores from a text file named "exams."
Sample input would be:
Output will look like:
I have the following code:
Code:
My intent is to sum the values found in L and divide by len(L).
I think my issue is that when I split the values, I get a string array (ex. ['85', '90'] ), which makes it hard to do calculations.
View 5 Replies
View Related
Mar 25, 2011
I'm writing a script which will calculate bandwidth usage, I'm monitoring the bandwidth with cacti and the results don't quite line up, can someone either correct my script (if it contains faults) or tell me why the results aren't the same. I'm using a guide obtained from cisco here: [URL]. Here's my code:
Code:
SNMPCOMMUNITY=public
IP=127.0.0.1
INTNUMBER=1
OUT=$(snmpget -v2c -c $SNMPCOMMUNITY $IP ifOutOctets.$INTNUMBER | awk '{print $4}')
[Code]....
View 2 Replies
View Related
Jun 30, 2011
When I run df it shows the root device is full.
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 9.9G 9.4G 0 100% /
I looked at the inode usage and there is pretty much space available for root device
Filesystem Inodes IUsed IFree IUse% Mounted on
/dev/sda1 640K 103K 538K 16% /
But, when I run the du command, it shows I have used only 2G out of 9.9G.
ip-10-204-70-44:/$ du -xh --max-depth=1
14M ./etc
4.0K ./mnt[code]....
It just driving me crazy and interesting too. This is big problem for us since the root disk / is full and some of the function in our site is failing.
View 2 Replies
View Related
Dec 18, 2009
My monitor tools indicate that the percentage of swap used is more than the ideal , so I want to calculate which process is consuming from the swap. I tried the following but it didn't help be 100%
#ps -eo vsz,rss,pid,args | sort -n
How to accurately calculate which process consuming from swap, just the swap no ram + swap!
View 6 Replies
View Related
Jan 18, 2010
I am writing my own syslog collector, but im stuck with calculating the severity of the message. The PRI value is calculated:-
Code:
(Facility * 8) + Severity
But from the context of a collector, neither Facility or severity would be known? You need to know either severity or Facility to calculate facility or severity?! The RFC goes in to no more detail about calculating the severity value, other tan this expression.
View 1 Replies
View Related
Dec 21, 2010
I am trying to update from ubuntu 10.04.1 to 10.10 using the do-release-upgrade command. I get this error:
Code:
An unresolvable problem occurred while calculating the upgrade: The package 'update-manager-core' is marked for removal but it is in the removal blacklist.
This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu
The first two can't be correct right? So... If the third one is true. How can I find these packages? Or, is there any other way to upgrade to 10.10?
View 5 Replies
View Related
Apr 20, 2011
I have a data in a column.
Code:
I want to calculate average and standard deviation. As first step I want to calculate average for the data than calculate (del=data - avg) for all the data.
I suppose get
Code:
For this I use AWK and the code goes like this
Code:
But I get different answers.
Code:
Why the answers are so different? since this is wrong I can not continue calculating the standard deviation.
View 6 Replies
View Related
Apr 26, 2011
I have just tried to upgrade to Ubuntu 10.10 from 10.04 using the update manager
It asks me for me password and then a window opens saying "Upgrading Ubuntu to version 10.10"
It gets to "setting new software channels" then a message pops up saying "third party sources disabled" next a little error icon appears in the Notification Area then another message saying: Could not calculate the upgrade
An unresolvable problem occurred while calculating the upgrade: E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.
This can be caused by:
-Upgrading to a pre-release version of Ubuntu
-Running the current pre-release version of Ubuntu
-Unofficial software packages not provided by Ubuntu
If none of this applies, then please report this bug against the 'update-manager' package and include the files in /var/log/dist-upgrade/ in the bug report.
View 1 Replies
View Related
Nov 30, 2010
i have installed ns 2.33 and added the patch mobiwan for supprting mobile ipv6. i ran some tcl scripts , and below is the trace file generated. calculate the handoff latency, and if someone has awk or perl script to do so, tcl file [URL] out.tr [URL]
View 1 Replies
View Related
Sep 10, 2009
Actually i m new to scripting in Linux, we have RedHat Server Edition 4 in which different software licences are installed and software itself installed at client side. the usage of the software is recorded daily in a text file which is of format
I want to write a script that checks that for any OUT & IN, if utility, user and Client PC Name are same then subtract OUT Time from IN Time. This has to be done for each & every user and utility.Is there any GUI programming possible in Linux.
View 7 Replies
View Related
Apr 23, 2010
I am new to shell script and to this form as well, I did try to search for a similar post like mine here, but could not find one.
Here is what I'm trying to do:
I am trying to grep server logs to find a specific string and then capture the time stamp and the value of that grep string in them. The log file prints out messages on per sec basis.
My script is able to grep the server logs for the entire period of my load runs and then outputted it to a .csv file too.
Unfortunately this .csv file is too large to extract it on my PC and to generate graphs as it exceeds the excel limit. I need some help on how to read this .csv file in a shell script and then take an average on per min basis before I can export it out on my desktop and generate graphs for analysis. example of the out in my .csv file:
View 1 Replies
View Related
Mar 24, 2011
We have 5 servers here. What we are going to setup is not a Web server. We want to combine these servers to parallel calculating. I have searched for some information. May be cloud computing would be our choice. I don't know whether I am right.and if I decide to use the cloud, is Ubuntu server my best choice?Can anyone give me some clue about this?
View 4 Replies
View Related
Dec 2, 2010
I have an array called arrayini which stores numbers. I want to take log to the base 2 of each of the numbers in that array and put it in file called result. I've used the following code to do it.
Code:
size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
echo "scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >result
It works fine but its taking pretty long to calculate since I've got about 230,000 items in the array. So I decided to store the result into an array hoping that it'd be faster. I tried the following code. arrayresult is where I try and store the result. The code doesn't work because of the second last line.
Code:
unset arrayresult
size=${#arrayini[@]}
for ((i=0;i<size;i++))
do
arrayresult[$i]="scale = 12; l(${arrayini[$i]})/l(2)" | bc -l
done >FILE2
There is a syntax error clearly.
View 6 Replies
View Related
Feb 12, 2011
I keep getting the following msg as I try to upgrade from 10.04 -> 10.10 ... "Could not calculate the upgrade An unresolvable problem occurred while calculating the upgrade: E:Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages. This can be caused by:
* Upgrading to a pre-release version of Ubuntu
* Running the current pre-release version of Ubuntu
* Unofficial software packages not provided by Ubuntu
If none of this applies, then please report this bug against the 'update-manager' package and include the files in /var/log/dist-upgrade/ in the bug report." I don't think any of the issues above apply - can anyone offer advice on how to get around or "force " the upgrade
View 1 Replies
View Related
Jan 4, 2010
i have 2 dvds and i want to create an iso image out of it. is there any way to do that?
View 1 Replies
View Related
Jul 21, 2010
I am trying to make an app launcher for Ubuntu which replaces the top bar (default) in gnome. It will be a menu system in the middle of the screen which you would click on parts to bring up lists of apps and locations. What would be the easiest way to do this, and in which code?
View 2 Replies
View Related
Jul 26, 2010
I'm having issues creating a share with 10.04 - but those I'll try and sort out by myself, how Ubuntu creates samba shares these days?
On a test machine I can create shares, but am having some permission issues. I go to the smb.conf file but can't find the created share? Where does Ubuntu store the new config file for creating samba shares? I assume I can just override by creating a share by hand in the smb.conf file like a always do, but I'd rather try and work with, rather than against 10.04.
View 1 Replies
View Related
Sep 6, 2010
if anyone knows any trick to create a folder that deletes its contents on every boot, like "/tmp" but on a different hard drive since i have 2 internal hdd's.
[For saving massive temporary cache files, to increase overall speed (1 hdd for use, 1 hdd for storage/temp storage).]
View 2 Replies
View Related
Mar 10, 2011
Any idea how one can accomplish this? Oh, and is there a GUI tool that can help with the process?
View 8 Replies
View Related
May 11, 2011
i have backed up a dvd on my hard driveit is in the standard videots/.vob formation & plays fine using vlc / movie player.how do i transfer it to a dvd disc to play on an external dvd player?i have tried using k9copy / brasero / k3b but none have produced a playable dvd. the dvd's produced fail to load on the dvd player connected to my tv.
View 4 Replies
View Related
Aug 2, 2011
I was in the process of registering with the ubuntu bug squad. As i was finishing the UbuntuCodeofConduct agreement form, I ran this command to create a signature key to sign the form.
#sudo gpg --clear UbuntuCodeofConduct-1.1.txt
After the program ran I got this message.
gpg: no default secret key: secret key not available
gpg: UbuntuCodeofConduct-1.1.txt: clearsign failed: secret key not available
Apparently, I don't have a default secret key. How do I create one?
View 3 Replies
View Related
Jan 18, 2010
I want to make a script to create a videos , photos, and documents folder in all of my (or anyone's) user's home folder. Wildcards don't seem to work if I try to put in: sudo mkdir /home/WILDCARD/videos here is my error.
mkdir: cannot create directory `/home/*/videos1': No such file or directory
and just to clarify i want all user's to have there own seperate folders not shared.
P.S. I tried with the -p switch and no luck. I just got a new home folder for * with the videos folder inside.
View 6 Replies
View Related
Feb 3, 2010
I recently created a new user account in ubuntu linux, and created a file called xsession so that I can boot directly into xmbc when I log into that account. Is there anyway to delete the home folder for that account. I can view the file but when I try to delete it is says I do not have apporite permisions to delete the file.
I removed the account and deleted the group but it still shows up when I type in the address /home/xmbc
Is there anyway I can delete this file. It also will not let me create any new user accounts is there any way I can fix these prolbems without totaly reinstalling the system.
View 2 Replies
View Related