Episode 19: Nextcloud AIO, OpenCloud and Seafile measured with the same test data on the same server

This commit is contained in:
Maximilian Grimm 2026-10-24 20:37:53 +02:00
parent 76a3132a17
commit 145d318452
70 changed files with 3296 additions and 0 deletions

20
filesync/lib.sh Normal file
View file

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# ep19fs Lab-Helfer (Server und Clients). Keine Geheimnisse im Output.
now() { date +%s.%N; }
ts() { date -u +%H:%M:%S; }
el() { python3 -c "print(f'{float(\"$2\")-float(\"$1\"):.2f}')"; }
# hostsample SECONDS OUTFILE: Host-CPU% und RAM (MemTotal-MemAvailable) im 1-s-Takt
hostsample() { python3 - "$1" "$2" <<'PY'
import sys,time
dur=float(sys.argv[1]); out=open(sys.argv[2],'w')
def cpu():
v=list(map(int,open('/proc/stat').readline().split()[1:])); idle=v[3]+v[4]; return sum(v),idle
def mem():
d={l.split(':')[0]:int(l.split()[1]) for l in open('/proc/meminfo')}
return (d['MemTotal']-d['MemAvailable'])/1024
t0=time.time(); a=cpu()
while time.time()-t0<dur:
time.sleep(1); b=cpu(); tot=b[0]-a[0]; idl=b[1]-a[1]; a=b
out.write(f"{time.strftime('%H:%M:%S',time.gmtime())}\t{100*(tot-idl)/max(tot,1):.1f}\t{mem():.0f}\n"); out.flush()
PY
}