Sponsored Content
Full Discussion: integer treated as text?
Top Forums Shell Programming and Scripting integer treated as text? Post 302348414 by shantanuo on Friday 28th of August 2009 07:14:48 AM
Old 08-28-2009
integer treated as text?

The following script should kill all the queries taking more than say 600 seconds. But it seems that it is killing queries taking more than 6 seconds.

>> sh myscript.sh 600

Code:
#!/bin/bash
#kill runaway processes
SEC=$1
ifs='|'
if [[ $SEC -lt 1 ]]; then
echo "Usage: $0 seconds"
exit 1
fi
mysqladmin processlist -v | grep Query | grep -Evi "delete|update|insert|alter table" | while read dummy qid qusr qhost qdb qstat qsec qstat2 query
do
  if [[ $qsec > $SEC ]]; then
    echo "Killing query $qid..."
    mysqladmin kill $qid
  fi
done


Last edited by Franklin52; 08-28-2009 at 08:20 AM.. Reason: Please use code tags!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

ksh script: 'exit' being treated as 'break 2'

hi, in a korn shell script, has anyone ever seen an 'exit' being treated as a 'break 2'? I have a script which has 3 nested loops. Within the inner most loop, i'm trying to exit the script on a fault condition. instead of exiting, it's acting as a 'break 2' and then continuing on with the... (4 Replies)
Discussion started by: gsatch
4 Replies

2. IP Networking

how to pass integer

i am writing a client and server program client program main() { int sockfd,n; char str; struct sockaddr_in sock; if ((sockfd=socket(AF_INET,SOCK_STREAM,0))<0) { perror("SOCKET ERROR"); } bzero(&sock,sizeof(sock)); sock.sin_family=AF_INET; (1 Reply)
Discussion started by: ramneek
1 Replies

3. Shell Programming and Scripting

get integer part

Hi, I did a df|awk| command and it returns a percentage "94%", how could I only get the integer part "94" out of it, so I can compare it to another number, I knwo that I have to pipe it to sth, but "grep " did not work, it still give me number WITH the percentage, does someone know what... (3 Replies)
Discussion started by: ericaworld
3 Replies

4. Programming

error: initializer expression list treated as compound expression

I had seen this error for the first time ..... error: initializer expression list treated as compound expression please help.... (12 Replies)
Discussion started by: arunchaudhary19
12 Replies

5. Shell Programming and Scripting

Array values treated as one

I want each integer to be a value/element in the array, however the string is being treated as one. How can I stream these into distinct values? PSF6INDEX=`(snmpwalk -v 2c -c 'H0meru!es' ${SWITCH} .1.3.6.1.2.1.2.2.1.2 | grep 'GigabitEthernet' | sed 's/IF-MIB::ifDescr\.//g' | awk '{print $1}' |... (1 Reply)
Discussion started by: cytriesbash
1 Replies

6. Shell Programming and Scripting

Text data string conversion to Integer

Folks Appreciate your help in understanding issue in relation to below. I need to pul uvalue from a file (tmpfile) and compare it with a number to make decision. Using #!/bin/sh contents of tmpfile : Slot uvalue : 0.16 How I am pulling it: unifval=`awk '/uvalue/ {print $4}' tmpfile` ... (1 Reply)
Discussion started by: wndgs
1 Replies

7. UNIX for Dummies Questions & Answers

integer to string

Hi all, is there an easy way to convert integer to string in bash? I have numbers like 1, 2, ..., 112, ... and I would like to get 001 002 003 004 ... Thank you, Sarah (4 Replies)
Discussion started by: f_o_555
4 Replies

8. Shell Programming and Scripting

how to compare string integer with an integer?

hi, how to I do this? i="4.000" if ; then echo "smaller" fi how do I convert the "4.000" to 4? Thanks! (4 Replies)
Discussion started by: h0ujun
4 Replies

9. Shell Programming and Scripting

Compare the text/integer value from the log file

i have some log (temp.txt) file like temp.txt: Filesystem size used avail capacity Mounted on /dev/md/dsk/d30 9.8G 9.7G 14M 100% /opt /dev/md/dsk/d72 187M 61M 107M 37% /osmf/mgmt /dev/md/dsk/d71 187M 140M 29M 83% /export/home /dev/md/dsk/d70 7.9G 4.3G 3.5G 56% /var/crash /dev/md/dsk/d74... (6 Replies)
Discussion started by: doubt
6 Replies

10. Programming

Are These All The Integer Types In C

Hello and Good day, I am currently studying C and I just finished learning about variables mainly those of integer type. I am wondering if the list below are all there is to integer variables and there are still more that i have to learn. Here are the list: Char Short int long long long... (3 Replies)
Discussion started by: split_func0
3 Replies
fair.conf(5)						      BSD File Formats Manual						      fair.conf(5)

NAME
fair.conf -- configuration file for the carrousel and transponder daemons DESCRIPTION
Debug (bool, false) Runs the program in debug mode: it will not detach, it will print status updates very frequently, it will print extra diagnostic mes- sages to stderr. DropPrivs (bool, true) The program will switch to a different uid/gid after obtaining root-only resources. See also the UserID and GroupID variables. WorkerService (string, smtp) * This is the service on which the worker nodes offer the service that is being balanced. Typically this is the service of another dae- mon, e.g. Postfix. The transponder daemon also uses this as the datagram source service for its status updates. BalancerService (string, smtp) * The stream service on which the carrousel daemon listens for incoming connections. These connections will be put through to one of the worker nodes. TransponderService (string, rlp) * The carrousel daemon listens on this service for status update datagrams from the transponders. See also the AllowUDP variable. PingInterval (time, 0.1 seconds) How often the transponder sends an update to each carrousel. So, if two carrousels are configured and the interval is 0.1 seconds, that transponder sends 20 packets every second. PingTimeout (time, 0.5 seconds) After this period has elapsed without receiving any status update packets from the transponder, this host is considered dead. IdleTimeout (time, 600.0 seconds) The connection is terminated if neither party has sent something for this many seconds. For SMTP connections this would have to be at least 600.0 seconds, see RFC 2821 section 4.5.3.2. ConnectTimeout (time, 1.0 seconds) When connecting to a worker node, abort after this many seconds have elapsed and no connection is established. ConnectAttempts (integer, 3) When putting through a connection fails, the carrousel will attempt to contact other worker nodes. It will give up after this many tries. BenchPeriod (time, 5.0 seconds) If a connection to a worker node fails it is excluded from new connections for this many seconds. TrailPeriod (time, 60.0 seconds) When a connection is finished, pretend it lasted this many seconds more for load calculation purposes. Hysteresis (integer, 0) Add an advantage to the last used worker node so that it gets selected in preference of others. MaxCapacity (integer, 100) When sending update packets, the capacity of the worker node measured in terms of concurrent connections. This number is adjusted for the current load average before sending it to the carrousel nodes. MaxBurst (integer, 65536) Ringbuffer size for load balancer nodes. MinBurst (integer, 1450) If fewer than this many bytes are available in the ring buffer, do not read anything but try to free up space first. LocalTCP (bool, yes) Only allow connections over the loopback interface. If this option is set to "no", connections will be accepted on any interface and on any address. AllowUDP (extended regexp, ^) Only datagram status packets that match this extended regular expression are accepted. All other datagram packets are logged and silently dropped. Once UDP packets are accepted from a certain source, they are never matched against this regexp again. SEE ALSO
carrousel(8), transponder(8) Debian GNU/Linux June 1, 2019 Debian GNU/Linux
All times are GMT -4. The time now is 10:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy