dot

packages and services management
Log | Files | Refs | README

commit 1e5f31a77fa40ebac9a5e1f8767ae1f722089d75
parent 821b56480d2d63313a0148ae860b615523277d43
Author: Josuah Demangeon <josuah.demangeon@gandi.net>
Date:   Mon, 24 Jul 2017 11:13:23 +0200

bin/monitor: log to file rather than stdout

Diffstat:
Mbin/monitor | 9++++++---
1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/bin/monitor b/bin/monitor @@ -7,14 +7,17 @@ # 3. free memory 7. total free storage # 4. cpu usage +VAR="${VAR:-$HOME/var}" + +mkdir -p "$VAR/stat" + case "$(uname)" in (Linux ) mem=free cpu=id bi=bi bo=bo b='' ;; (*BSD ) mem=fre cpu=id bi='' bo='' b="$disks" ;; (Solaris) mem=free cpu=id bi='' bo='' b="$disks" ;; esac -vmstat 2 2 | -awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" ' +vmstat 2 2 | awk -v mem="$mem" -v cpu="$cpu" -v bi="$bi" -v bo="$bo" ' BEGIN { "date +%Y-%m-%d-%H-%M" | getline date @@ -48,4 +51,4 @@ NR >= 4 { diskio += table[diskv[disk]] print host " " date " " mem " " cpu " " load " " diskio " " stor -}' +}' >> "$VAR/stat/now"