From - Thu Oct 16 13:20:47 1997 Path: news.mitre.org!blanket.mitre.org!news.tufts.edu!usenet.logical.net!nntprelay.mathworks.com!howland.erols.net!newsfeed.internetmci.com!192.48.96.123!in1.uu.net!nclient1-gui.server.virgin.net!not-for-mail From: "Matt Roxburgh" Newsgroups: vmsnet.sysmgt Subject: usefule command prcoedures 3/3 Date: 16 Oct 1997 09:42:50 GMT Organization: Virgin Net Usenet Service Lines: 180 Message-ID: <01bcda20$1d5a5840$4e01210a@matt> NNTP-Posting-Host: p21-albatross-gui.tch.virgin.net X-Newsreader: Microsoft Internet News 4.70.1155 $! SHOW SYSTEM replacement although you may want to check out the SHS program which is $! pretty neat ! $! comments to : matthew.roxburgh@virgin.net $! $! P1 - username or partial username $! P2 - image name or partial imagename $! P3 - process types to exclude (B, S, I, O or N) $ $! (c) Matt Roxburgh 1993 $ $! 'f$verify(0) $ $ t_cnt = 0 $ t_wsp = 0 $ t_wsc = 0 $ escape_char[0,8] = 27 $ norm = "''escape_char'[0m" $ bold = "''escape_char'[1m" $ rev = "''escape_char'[7m" $ flash = "''escape_char'[5m" $ flashoff = "''escape_char'[25m" $ dummy := "" $ pid = f$pid(dummy) $ if pid .eqs. "" then exit $ $ mypid = f$getjpi("", "MASTER_PID") $ if mypid .eqs. "" then mypid = f$getjpi("", "PID") $ myuser = f$getjpi(mypid, "USERNAME") $ $ crap_username = "" $ $ filter_list = "''P3'+" $ $ dummy := "" $ pid = f$pid(dummy) $ if pid .eqs. "" then exit $ $ old_width = f$getdvi("SYS$OUTPUT", "DEVBUFSIZ") $ set term /wid=132 $ say := write sys$output $ type nla0: /page $ $ say "System Summary For Node : ", f$logical("sys$node"), " @ ", f$time() $ say " " $ say "''norm' logon proc " $ say "''norm'process id username process name terminal prio state im" $ say "''norm'---------- ------------ -------------- -------- ---- ----- --" $ write sys$output "''escape_char'[6;24r''escape_char'[5;1f" $ $ users_active = 0 $ users = 0 $ batch = 0 $ batch_active = 0 $ $ loop: $ $ mpid = f$getjpi(pid, "MASTER_PID") $ if "''mpid'" .eqs. "" then mpid = pid $ $ username = f$getjpi(mpid, "USERNAME") $ if username .eqs. crap_username then username = "Not Applic " $ if username .nes. crap_username then username = f$extract(0,12,"''usernam) $ $! if username .eqs. " " then goto skip $ if f$extract(0,f$length(P1),username) .nes. P1 then goto skip $ $ proc_type = f$extract(0,1,"''f$getjpi(pid, "MODE")'") $ if mpid .ne. pid .and. mpid .nes "" then proc_type = "S" $ if f$locate(proc_type, filter_list) .nes. f$length(filter_list) then gotop $ $ if proc_type .eqs. "I" then proc_type = " " $ $ terminal = f$extract(0,8,"''f$getjpi(mpid, "TERMINAL")' ") $ pname = f$extract(0,14,"''f$getjpi(pid, "PRCNAM")' ") $ tmp = f$parse(f$getjpi(pid, "IMAGNAME"),,,"NAME",) + f$parse(f$getjpi(pid) $ image = f$extract(0,12,"''tmp' ") $ if image .eqs. " " then - image = f$extract(0,12,"''f$getjpi(pid, "CLINAME")' ") $ $ if f$extract(0,f$length(P2),image) .nes. P2 then goto skip $ $ file_count = f$getjpi(pid, "FILLM") - f$getjpi(pid, "FILCNT") $ file_count = " ''file_count'" $ file_count = f$extract (f$length(file_count) - 4, 4, file_count) $ $ mounted_vol = f$getjpi(pid, "VOLUMES") $ mounted_vol = " ''mounted_vol'" $ mounted_vol = f$extract (f$length(mounted_vol) - 3, 3, mounted_vol) $ $ image_count = f$getjpi(pid, "IMAGECOUNT") $ image_count = " ''image_count'" $ image_count = f$extract (f$length(image_count) - 3, 3, image_count) $ $ cpu_time = "''f$getjpi(pid, ""CPUTIM)'" $ if f$length("''cpu_time'") .lt. 3 then - cpu_time = f$extract (f$length("00''cpu_time'") - 3, 3, "00''cpu_time) $ cpu_time = " ''f$extract(0, f$length(cpu_time) - 2, cpu_time)'.''f" $ cpu_time = f$extract (f$length(cpu_time) - 8, 8, cpu_time) $ $ state = f$extract(0,5,"''f$getjpi(pid, "STATE")' ") $ $ state = f$extract(0,5,"''f$getjpi(pid, "STATE")' ") $ $ prio = f$extract(0,4," ''f$getjpi(pid, "PRI")' ") $ $ logintim = " " $ if proc_type .eqs. " " then - logintim = f$extract(0, 17 ,"''f$getjpi(pid, "LOGINTIM")'") $ $ today = f$extract(0,10,f$cvtime("TODAY")) $ yesterday = f$extract(0,10,f$cvtime("YESTERDAY")) $ $ logtim = f$extract(0,10,f$cvtime(logintim)) $ $ if logtim .lts. today then logintim = escape_char + "[7m" + logintim $ if logtim .lts. yesterday then logintim = escape_char + "[5m" + logintim $ $ wsquo = f$getjpi(pid, "WSQUOTA") $ $ wssizen = f$getjpi(pid, "WSSIZE") $ wssize = " ''wssizen'" $ wssize = f$extract (f$length(wssize) - 5, 5, wssize) $ $ wspeakn = f$getjpi(pid, "WSPEAK") $ wspeak = " ''wspeakn'" $ wspeak = f$extract (f$length(wspeak) - 5, 5, wspeak) $ $ if wssizen .gt. wsquo then wssize = rev + wssize $ $ if wspeakn .gt. wsquo $ then $ wspeak = rev + wspeak $ else $ wssize = wssize + norm $ endif $ $ t_wsc = t_wsc + wssizen $ t_wsp = t_wsp + wspeakn $ t_cnt = t_cnt + 1 $ $ logo = "''norm'" $ if f$getjpi(pid, "USERNAME") .eqs. myuser then logo = logo + bold $ if f$getjpi(pid, "MASTER_PID") .eqs. mypid then proc_type = logo + bold +e $ $ say "''logo'''pid' ''proc_type'''logo' ''username' ''pname'", - " ''terminal' ''prio' ''state' ''image' ''cpu_time' ", - "''file_count' ''mounted_vol' ''image_count'", - " ''wssize'/''logo'''wspeak'''norm' ''logo'''logintim'''norm'" $ $ skip: $ $ pid = f$pid(dummy) $ if pid .nes. "" then goto loop $ $ tcnt = f$fao("!5UW", 't_cnt') $ twsc = f$fao("!8UL", 't_wsc') $ write sys$output "Total : ''tcnt' ",- " ", twsc, "/", tp $ $ write sys$output "''escape_char'[0;24r''escape_char'[23;1f" $ $ if old_width .ne. 132 $ then $ inquire/nopunct cont "" $ set term /width='old_width' $ endif