meta data for this page
  •  

Szebb 'q process' kimenet

6-os szerver verzióhoz írt lekérdezés, mely sortörés nélkül írja ki a 'q process' kimenetét, adatátviteli sebességekkel és process start idővel kiegészítve.

tsm_q_proc.sh
#!/bin/sh
TSMSERVER='tsmsrv01'
ID='tsm_user'
PA='tsm_pass'
 
RED='\033[0;31m'
GREEN='\033[0;32m'
CYAN='\033[0;36m'
LIGHT_GREEN='\033[1;32m'
YELLOW='\033[1;33m'
LIGHT_CYAN='\033[1;36m'
DEFAULT='\033[0m'
SQL='SELECT process_num, substr(process,1,20) as PROCESS, substr(char(start_time),1,19) AS START_TIME,substr(char(days(current_timestamp) - days(start_time)),1,2) AS "(D)" ,substr(char((current_timestamp - start_time)hours),1,2) AS "(HH)", substr(char((current_timestamp - start_time)minutes),1,2) AS "(MM)", cast(float(bytes_processed/1024/1024) AS DEC(12,2)) AS MB, cast((cast(bytes_processed as dec(18,0))/cast(timestampdiff(2,char(current_timestamp-start_time)) as decimal(18,0))) / 1024 / 1024 AS DEC (18,2)) AS "MB/s" FROM processes'
 
echo -e "$GREEN$TMSERVER:$DEFAULT"
echo "PROCESS_NUM   PROCESS                START_TIME            ELAPTIME              MB               MB/s"
echo "-----------   --------------------   -------------------   -----------   ----------   ----------------"
dsmadmc -pa=$PA -id=$ID -dataonly=y -se=$TSMSERVER -commadel -displ=list "$SQL" | awk -F',' '{printf "%-11s   %-20s   %-19s   %2dd %2dh %2dm   %11s %17s\n", $1, $2, $3, $4, $5, $6, $7, $8 ,$9}'