From c0f74003284833e1fd728aa286c7dcc91fc0469f Mon Sep 17 00:00:00 2001 From: MeaTLoTioN Date: Wed, 17 Aug 2022 03:51:23 +0100 Subject: [PATCH] initial commit --- scripts/wfc.mpy | 85 ++++++++++++++++++++++++++++++++++++++++++++++ text/wfc/main.ans | Bin 0 -> 2284 bytes 2 files changed, 85 insertions(+) create mode 100644 scripts/wfc.mpy create mode 100644 text/wfc/main.ans diff --git a/scripts/wfc.mpy b/scripts/wfc.mpy new file mode 100644 index 0000000..a0bd457 --- /dev/null +++ b/scripts/wfc.mpy @@ -0,0 +1,85 @@ +from mystic_bbs import * +from datetime import datetime +import os, subprocess + +now = datetime.now() +TEXT = str(getcfg()['text']) +DATE = now.strftime("%a, %b %e %Y, %H:%M") + +CFG = str(getcfg()) +USER = str(getuser()) +HANDLE = str(getuser()['handle']) + +def dispHeader(): + A = mci2str('AV') + V = mci2str('IL') + + if A == "Yes": + AVAIL = "|10YES" + else: + AVAIL = "|12NO " + + if V == "On": + INVIS = "|12NO " + else: + INVIS = "|10YES" + + gotoxy(2,1); write("|10"+DATE) + gotoxy(35,1); write("|$C15"+HANDLE) + gotoxy(57,1); write("|02Avl: "+AVAIL) + gotoxy(72,1); write("|02Vis: "+INVIS) + +def dispTotals(): + gotoxy(64,12); write("|08|$l14.|15|TC") + +def dispSysInfo(): + MEMFREEMB = 0 + MEMTOTALMB = 0 + with open('/proc/meminfo') as file: + for line in file: + if 'MemTotal' in line: + MEMTOTALKB = line.split()[1] + MEMTOTALMB = int(MEMTOTALKB) / 1024 + if 'MemFree' in line: + MEMFREEKB = line.split()[1] + MEMFREEMB = int(MEMFREEKB) / 1024 + gotoxy(11,13); write("|15"+str(MEMFREEMB)+" MB |08/ |15"+str(MEMTOTALMB)+" MB") + + NUMPROCS = os.popen('nproc').read().strip('\n') + LOADAVG = os.popen('uptime|grep -oE "average:.*"').read().split(':')[1].strip('\n').split(',') + UPTIMES = float(os.popen("cat /proc/uptime|awk '{print $1}'").read().strip('\n')) + UPTIMEM = UPTIMES / 60 + UPTIMEH = UPTIMEM / 60 + UPTIMED = UPTIMEH / 24 + PROCESS = os.popen('ps auxwww|grep -v PID|wc -l').read().strip('\n') + gotoxy(11,14); write("|151m "+LOADAVG[0].strip(' ')+" |08/|15 5m "+LOADAVG[1].strip(' ')+" |08/|15 15m "+LOADAVG[2].strip(' ')) + gotoxy(11,15); write("|15Up: "+str(int(UPTIMED))+"d "+str(int(UPTIMEH) % 24)+"h "+str(int(UPTIMEM) % 60)+"m / Running "+str(int(PROCESS))) + +def dispQuickLog(log="mis"): + LOGDIR = "/mystic/logs" + + if log.lower() == "mis": + logFile = 'grep -vE "HTTP|BINKP|HostName|Blocked|Connect|EVENT" `ls -1hrt '+LOGDIR+'/mis.*.log|tail -1`|tail -n5|head -n4|cut -c -76' + elif log.lower() == "mutil": + logFile = 'tail -n4 '+LOGDIR+'/mutil.latest.log|cut -c -76' + else: + logFile = 'tail -n4 '+LOGDIR+'/node'+log+'.log|cut -c -76' + + #QUICKLOG = os.popen('grep -aih "logged in$" '+LOGDIR+'/node*.log|sort|tail -n4').read() + SY = 19 + OS = 0 + #lines = os.popen('grep -aih "logged in$" '+LOGDIR+'/node*.log|sort|tail -n4').readlines() + lines = os.popen('grep -vE "HTTP|BINKP|HostName|Blocked|Connect|EVENT" `ls -1hrt '+LOGDIR+'/mis.*.log|tail -1`|tail -n5|head -n4|cut -c -76').readlines() + lines = os.popen(logFile).readlines() + lines = map(lambda s: s.strip(), lines) + for line in lines: + gotoxy(3,SY+OS); write("|17|15"+line.ljust(76)+"|16") + OS = OS + 1 + +writeln("|CL") +menucmd('GD','@0@NONE@'+TEXT+'wfc/main.ans') +dispHeader() +dispTotals() +dispSysInfo() +dispQuickLog('mis') +gotoxy(1,24); writeln("|PA") diff --git a/text/wfc/main.ans b/text/wfc/main.ans new file mode 100644 index 0000000000000000000000000000000000000000..0fd618b7f3947455a5374c80fecbff92614cadc3 GIT binary patch literal 2284 zcmdT_Pfx-y6vvw(;o?oXyu>>hsAythQgE8ZjVkRF;)%dCB+L;I{a|p%M8AZ78p|u& zTC*|#go8bFuYIq--}}?o6>kl{kcST_-jn!q^WE-MNZyk(6!;D`V?Jtb|1 z5IVwK&`br5AaTWf=u3H5kzHmsC7hfWewfO}Ws`DRr?xyYm6|1Hw=)=wLo5-B;g__5 z(M-{Y6DZ4YzuJ`02s805mBiHC7zX3VZ@K|cS(_UV-ZMu^IUTP(`_ z1MIJXQPjTb!(=!JI=yAsf*5yu!SjQ%9eNS_l_^Dct<`FU#<92ne3c%#`n?`i12_WgZMqQE)j#AXRG&(!p=HshuP zR^yB|9l|ZzNI0S9EJ_cS@&|2>_P*zfuXt=qB`x0cMO11$kNuo{TV+<`SFJmo{E2E+ zzb-2Im2Wr-x=X_JXf%x;+FgI(rM(Xt--}v~Z24Vsrkr{&5w4ndC_(fl=Cj1|ODaFe!K#~QPe1{RYZW_kw?4Z{1I@}I;KWN0p_apMu kj+ZD^j7r5gDj)PWbGeO;%iMMj$Cg!d;QE}%RWuj!pZ0=-zyJUM literal 0 HcmV?d00001