File: sqlps

package info (click to toggle)
slash 2.2.6-8etch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 3,672 kB
  • ctags: 1,915
  • sloc: perl: 23,113; sql: 1,878; sh: 433; makefile: 233
file content (28 lines) | stat: -rw-r--r-- 815 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#!/usr/bin/perl
# This code is a part of Slash, and is released under the GPL.
# Copyright 1997-2001 by Open Source Development Network. See README
# and COPYING for more information, or see http://slashcode.com/.
# $Id: sqlps,v 1.3 2001/03/21 13:45:49 brian Exp $

###############################################################################
# this gives a process list of the database
###############################################################################
@p=split /\|\n/, `mysqladmin -u root processlist`;
foreach(@p) {
	if(!/^\+/ and !/Sleep/ and !/localhost/) {
		s/\s/ /g;
		s/  / /g;
		s/[^_\'\-\+\.A-Z0-9\(\) ,=\|]//gi;
		s/SELECT(.*)FROM/SELECT:FROM/g;
		my @x=split(/\|/);
		
		$x[3]=~s/\.dn\.net//g;
		
		my $s="$x[3]$x[6]\t$x[8]";
		
		$s=substr ($s,1,75);
		print "$s\n";
	}
}

print "\n";