Return-Path: Received: from box.tin.it by localhost with POP3 (fetchmail-5.3.3) for michele@localhost (single-drop); Mon, 19 Mar 2001 08:19:47 +0100 (CET) Received: from delta.iweb.pl ([212.122.221.36]) by fep24-svc.tin.it (InterMail vM.4.01.03.13 201-229-121-113) with ESMTP id <20010318213315.ZTJX23149.fep24-svc.tin.it@delta.iweb.pl> for ; Sun, 18 Mar 2001 22:33:15 +0100 Received: from winda (pb214.torun.cvx.ppp.tpnet.pl [213.76.55.214]) by delta.iweb.pl (Postfix) with SMTP id 2B8C03AB86 for ; Sun, 18 Mar 2001 22:33:18 +0100 (CET) Message-ID: <001301c0aff2$fe7068a0$6401a8c0@winda> From: "Adam Gapinski" To: "Michele Andreoli" Subject: some features of mon Date: Sun, 18 Mar 2001 22:32:52 +0100 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_NextPart_000_0010_01C0AFFB.5E98D3E0" X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 5.00.2615.200 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Status: RO Content-Length: 2838 Lines: 132 This is a multi-part message in MIME format. ------=_NextPart_000_0010_01C0AFFB.5E98D3E0 Content-Type: text/plain; charset="iso-8859-2" Content-Transfer-Encoding: 7bit Because of Yours utility 'mon' prints uptime in seconds I write some function which convert this to some other - more friendly, I'm thin - format best regards Adam Gapinski ------=_NextPart_000_0010_01C0AFFB.5E98D3E0 Content-Type: application/octet-stream; name="mon" Content-Transfer-Encoding: quoted-printable Content-Disposition: attachment; filename="mon" #!/bin/sh=0A= =0A= #set -x=0A= =0A= mega()=0A= {=0A= k=3D`expr $1 / 1024`=0A= expr $k / 1024=0A= }=0A= =0A= up_time()=0A= # function up_time - gives uptime in more practical=0A= # format (day,hours,..etc) rather than only in seconds=0A= # Adam Gapinski 18.03.2001=0A= =0A= {=0A= # totally $d - days $m - minutes & $1 - seconds=0A= m=3D`expr $1 / 60`=0A= h=3D`expr $m / 60`=0A= d=3D`expr $h / 24`=0A= # remains=0A= h=3D`expr $h % 24`=0A= m=3D`expr $m % 60`=0A= s=3D`expr $1 % 60`=0A= echo "$d day(s), $h hour(s), $m minute(s), $s second(s)"=0A= }=0A= =0A= refresh()=0A= {=0A= =0A= cat <15):" "$*" =0A= echo=0A= echo=0A= echo "- Network"=0A= echo=0A= =0A= set -- `cat /proc/net/dev | sed -n /dummy:/!P | sed -n /:/P` =0A= =0A= while [ $# -gt 0 ]; do=0A= printf "%${lab}s Tx: %4s Rx: %4s" $1 $2 $7=0A= echo=0A= shift 12=0A= done=0A= =0A= echo=0A= echo "- IP accounting "=0A= echo=0A= =0A= set -- `cat /proc/net/ip_acct`=0A= shift 3=0A= while [ $# -gt 0 ]; do=0A= shift 7; count=3D$1; port=3D$2=0A= printf "%${lab}s %s:%5s " port $port $count=0A= echo=0A= shift 13=0A= done=0A= =0A= }=0A= =0A= pid=3D$2=0A= set -- $1=0A= =0A= refresh > /tmp/cnt=0A= =0A= if [ -z "$1" ] ; then=0A= exec muless -r 1 -e $0 /tmp/cnt=0A= fi=0A= =0A= =0A= ------=_NextPart_000_0010_01C0AFFB.5E98D3E0--