WPR FM
uid=9814(b13i2mwmyrdbxio) php=8.4.28
info
cwd /data/sites/web/b13i2mwmyrdbxio/www |
naik
Buka
-
cleanup-tmp-files.sh
860
x
-
system-stats-sample.sh
1236
x
D
wordpress/
D
wp-cli/
Upload
Simpan
#!/bin/bash set -Eeuo pipefail # Append the node-wide CPU and memory counters once per run. Only the crontab # of dedicated Boxes calls this; woop reads the file back in # Jail.get_node_system_stats() for the dashboard's Box health page. # Line: <epoch> <cpu_busy_jiffies> <cpu_total_jiffies> <mem_total_kb> <mem_available_kb> <cpus> STATS_FILE="${HOME%/}/.system-stats.log" KEEP_LINES=1500 read -r _ user nice system idle iowait irq softirq steal _ < /proc/stat # Steal is time the hypervisor gives to other VMs, not load this Box creates, # so it only counts towards the total (like the ShaaS cgroup CPU time). cpu_busy=$((user + nice + system + irq + softirq)) cpu_total=$((cpu_busy + idle + iowait + steal)) mem_total="$(awk '/^MemTotal:/ { print $2 }' /proc/meminfo)" mem_available="$(awk '/^MemAvailable:/ { print $2 }' /proc/meminfo)" cpus="$(grep -c '^processor' /proc/cpuinfo)" printf '%s %s %s %s %s %s\n' "$(date +%s)" "$cpu_busy" "$cpu_total" "$mem_total" "$mem_available" "$cpus" >> "$STATS_FILE" # Keep a little more than 24 hours of one-minute samples. if [ "$(wc -l < "$STATS_FILE")" -gt "$KEEP_LINES" ]; then tail -n "$KEEP_LINES" "$STATS_FILE" > "${STATS_FILE}.tmp" && mv "${STATS_FILE}.tmp" "$STATS_FILE" fi
Exec