Annotation of freem/contrib/%SS.m, revision 1.1.1.1
1.1 snw 1: %SS ; A.Trocha; System Job Status [1999/01/29- 3:42:04]
2: ; $Source: /cvsroot-fuse/gump/FreeM/mlib/%SS.m,v $
3: ; $Revision: 1.3 $ $Date: 2000/02/18 15:13:42 $
4: ;
5: N exec,s,pid,tty,stat,idle,prg,ss,ss1,i,tab,tab2
6: ;
7: S tab=8
8: S tab2=5
9: W !!,?20,"FreeM - System Job Status"
10: W !,?23,$ZD," ",$ZT
11: D ss
12: ;
13: ;--- show status
14: W !!,?23,"Partitions in Use: ",$G(ss)
15: W !
16: W !,?tab,"PID/JOB TTY STATUS IDLE NAME"
17: W !,?tab,"------- ----- ---------- -------- --------"
18: F i=1:1:$G(ss) D
19: . S s=ss(i)
20: . S pid=$P(s,"'"),stat=$P(s,"'",3)
21: . W !,?tab,$$lb(pid_$S(pid=$J:"*",1:""),10),$$lb("TTY"_$P(s,"'",2),8)
22: . W $$lb($S(stat="S":"Sleeping",stat="R":"Running",1:"Unknown"),13)
23: . W $$lb($P(s,"'",4),11),$P(s,"'",5)
24: W !,?tab,"------- ----- ---------- -------- --------"
25: W !!
26: W !,?tab2,"Max Parition Size/ Used Partition Size: ",$V(37),"/",$S
27: W !,?tab,"Number of Routine Buffers: ",$V(33)
28: W !,?tab," Max Size for Routine: ",$V(32)
29: W !!
30: Q
31: ;
32: lb(str,len) Q str_$J("",len-$L(str))
33: ;
34: ss N exec,s,prg,pid,tty,stat,idle
35: ;--- get system status
36: K %
37: S exec="!<ps -xa|grep "_$V(30,1)
38: X exec
39: F i=1:1:% D
40: . S s=$G(%(i))
41: . S prg=$TR($E(s,23,$L(s))," ")
42: . I prg'=$V(30,1) Q
43: . S pid=$TR($E(s,1,7)," ")
44: . S tty=$TR($E(s,8,10)," ")
45: . S stat=$TR($E(s,11,12)," ")
46: . S idle=$TR($E(s,13,22)," ")
47: . S ss=$G(ss)+1
48: . S ss(ss)=pid_"'"_tty_"'"_stat_"'"_idle_"'"_prg
49: . S ss1(pid)=ss
50: K %
51: Q
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>