+Majesticmerc MVC Posted January 6, 2013 MVC Share Posted January 6, 2013 Hi Haggis, getting a couple of bugs on Arch: First off, line 245 is emitting an error 'Command "arch" not found'. Quick Google tells me that Arch Linux doesn't have an arch command, you might have to use "uname -m" instead. Second, line 61 which greps for the "-release" files doesn't work right. It lists the contents of /etc okay, but seems to get stuck searching my entire home directory for something. Quick check seems that its trying to run the command: grep -r -e -l -e -a -s -e I've seen this before with grep, and I think it might be a bug thats there for historical reasons or something. Either way, the fix would be to use 'grep "\-release"' instead. The backslash stops grep from bugging out. Here's the patch for the bugs, tested on Arch only, so others will need to test for their own OS... *** stats.sh 2012-12-23 23:59:10.000000000 +0000 --- copy of stats.sh 2013-01-06 22:54:01.409394805 +0000 *************** *** 58,64 **** # Print a pretty logo for the Linux distribution the user is running. function print_logo { ! exists=`ls /etc/ | grep "-release" | wc -l` if [ "$exists" -gt "0" ]; then #if [ -e /etc/*-release ]; then id="$(cat /etc/*-release | grep -E '^ID[ ]*=[ ]*[A-Za-z]+[ ]*' | cut -d '=' -f 2)" --- 58,64 ---- # Print a pretty logo for the Linux distribution the user is running. function print_logo { ! exists=`ls /etc/ | grep "\-release" | wc -l` if [ "$exists" -gt "0" ]; then #if [ -e /etc/*-release ]; then id="$(cat /etc/*-release | grep -E '^ID[ ]*=[ ]*[A-Za-z]+[ ]*' | cut -d '=' -f 2)" *************** *** 242,248 **** res=$(xdpyinfo | grep dimensions | awk {'print $2'}) load=$(uptime | awk -F 'load average:' '{ print $2 }') # AFAIK there is no standard identification strings between CPU architectures. ! case $(arch) in x86_64|i386|i486|i586|i686) cpu="$(cat /proc/cpuinfo | grep 'model name' | head -n 1 | cut -d ':' -f 2-)" ;; --- 242,248 ---- res=$(xdpyinfo | grep dimensions | awk {'print $2'}) load=$(uptime | awk -F 'load average:' '{ print $2 }') # AFAIK there is no standard identification strings between CPU architectures. ! case $(uname -m) in x86_64|i386|i486|i586|i686) cpu="$(cat /proc/cpuinfo | grep 'model name' | head -n 1 | cut -d ':' -f 2-)" ;; Also, I have made for myself a PKGBUILD for this script so that I could install your script into the Arch package system. Would you like me to submit it as an AUR package that all Arch users can install and run it as the command "haggis-stats"? Karl L. 1 Share Link to comment Share on other sites More sharing options...
Karl L. Posted January 7, 2013 Share Posted January 7, 2013 First off, line 245 is emitting an error 'Command "arch" not found'. Quick Google tells me that Arch Linux doesn't have an arch command, you might have to use "uname -m" instead. I admit, that bug was introduced in a patch I submitted a while back. I do not run Arch Linux, and, therefore, didn't test my patch against it. I do find it slightly ironic that Arch Linux doesn't ship the arch utility, if for no other reason than their namesake! Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 7, 2013 Author Veteran Share Posted January 7, 2013 Hey guys i have a problem the lsb-release package is not on all distros so i need your help can you post the output of cat /etc/issue[/CODE] and also tell me the Distro your running Link to comment Share on other sites More sharing options...
yxz Posted January 7, 2013 Share Posted January 7, 2013 archlinux Arch Linux \r (\l)[/CODE] Haggis 1 Share Link to comment Share on other sites More sharing options...
Max Norris Posted January 7, 2013 Share Posted January 7, 2013 can you post the output of cat /etc/issue [/CODE] [code]Ubuntu 12.04.1 LTS \n \l Ubuntu Server. This is \n.\O (\s \m \r) \t Gentoo's default, although I've long since changed it. Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 7, 2013 Author Veteran Share Posted January 7, 2013 ok so cant rely on /etc/issue either lol Max does my script pick up Gentoo ok? Link to comment Share on other sites More sharing options...
Max Norris Posted January 7, 2013 Share Posted January 7, 2013 Max does my script pick up Gentoo ok? Works for the most part, a few errors at the beginning, but it's not running an X server or DE either like my previous posts. (No lsb_release, xdpyinfo or mate-session.) Displays the Tux penguin for its ASCII art. The OS field comes up as blank however. Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 7, 2013 Author Veteran Share Posted January 7, 2013 hmmmm i remember now lol Link to comment Share on other sites More sharing options...
Max Norris Posted January 7, 2013 Share Posted January 7, 2013 One more, finally got around to toying with the latest release. (Fine, I'll use one of these new fangled graphical thingies instead of my usual consoles.) Chakra Linux (2013.01.03 - Claire) \r (\n) (\l) ./stats.sh: line 245: arch: command not found .88888888:. 88888888.88888. .8888888888888888. 888888888888888888 88| _`88|_ `88888 88 88 88 88 88888 88_88_::_88_:88888 88:::,::,:::::8888 88`:::::::::``8888 .88 `::::` 8:88. 8888 `8:888. .8888` `888888. .8888:.. .::. ...:`8888888:. .8888.| :| `|::`88:88888 .8888 ` `.888:8888. 888:8 . 888:88888 .888:88 .: 888:88888: 8888888. :: 88:888888 `.::.888. :: .88888888 .::::::.888. :: :::`8888`.:. ::::::::::.888 | .:::::::::::: ::::::::::::.8 | .:8::::::::::::. .::::::::::::::. .:888::::::::::::: :::::::::::::::88:.__..:88888:::::::::::` ``.:::::::::::88888888888.88:::::::::` ``:::_:` -- `` -`-` ``:_::::`` OS: Chakra Linux Hostname: vm12 Uptime: 17 minutes CPU:Unknown RAM (used / total): 477 / 2006 Mb Desktop Enviroment: KDE 4.9.5 Logged in as: maxnorris Kernel: 3.6.6-1-CHAKRA Resolution: 1680x944 pixels Load Averages: 0.63, 0.53, 0.23 Top Process (by memory use): kdeinit4: This run didn't pick up the CPU, even though /proc/cpuinfo has correct info. (*shrug* it's a VM, but it picked it up with other distros properly.) Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 7, 2013 Author Veteran Share Posted January 7, 2013 ok so what does this give you cat /proc/cpuinfo | grep 'model name[/CODE] Link to comment Share on other sites More sharing options...
Max Norris Posted January 7, 2013 Share Posted January 7, 2013 ok so what does this give you cat /proc/cpuinfo | grep 'model name[/CODE] [code][maxnorris@vm12 ~]$ cat /proc/cpuinfo | grep 'model name' model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz model name : Intel(R) Core(TM)2 Duo CPU E8400 @ 3.00GHz Link to comment Share on other sites More sharing options...
CyberManifest Posted January 31, 2013 Share Posted January 31, 2013 Any chance of making this Apple / Mac OS X friendly? Apple logo and such? Link to comment Share on other sites More sharing options...
Karl L. Posted January 31, 2013 Share Posted January 31, 2013 Despite the fact that OS X and GNU/Linux are both UNIX-ey, most of the stuff that Haggis implemented in the script are actually Linux specific. For example, OS X has no /proc/cpuinfo or lsb_release (Linux Standard Base release information). Also, the script is implemented in BASH. While virtually every modern Linux distribution has BASH 4.0 or greater, OS X is stuck on the ancient BASH 3, which doesn't have many of the BASHisms modern scripts rely on. (For example, I have BASH 4.2 on Debian 7, but even Debian 6 has 4.1.) That said, I didn't write the script; Haggis did. Its up to him whether he wants to support it. Although, if you patched it to work on OS X and submitted the diff, he would probably be willing to accept it. Aergan 1 Share Link to comment Share on other sites More sharing options...
CyberManifest Posted January 31, 2013 Share Posted January 31, 2013 Aren't there Mac OS X alternatives to accomplish the same tasks perhaps an alternative script as a port or something is in order; something could use "awk", "grep", and "tail" and such against "uname" and such to aquire info? Or against "system_profiler | more" Link to comment Share on other sites More sharing options...
CyberManifest Posted January 31, 2013 Share Posted January 31, 2013 By the way... Ryans-MacBook-Air:~ ryan$ uname -aDarwin Ryans-MacBook-Air.local 12.2.0 Darwin Kernel Version 12.2.0: Sat Aug 25 00:48:52 PDT 2012; root:xnu-2050.18.24~1/RELEASE_X86_64 x86_64Ryans-MacBook-Air:~ ryan$ bash -versionGNU bash, version 3.2.48(1)-release (x86_64-apple-darwin12)Copyright (C) 2007 Free Software Foundation, Inc.Ryans-MacBook-Air:~ ryan$[/CODE] Link to comment Share on other sites More sharing options...
Yorak Posted January 31, 2013 Share Posted January 31, 2013 Hey man, forgot to test this earlier but it seems to work well. Nice job. Great script. :) Class 1 Share Link to comment Share on other sites More sharing options...
Haggis Veteran Posted January 31, 2013 Author Veteran Share Posted January 31, 2013 Glad you like it As per above only issue i have with making it work on MAC etc is i have no way of testing it Still working on making it better and more sleek too Link to comment Share on other sites More sharing options...
the evn show Posted February 2, 2013 Share Posted February 2, 2013 Removed Link to comment Share on other sites More sharing options...
Class Posted October 14, 2013 Share Posted October 14, 2013 Hey man, forgot to test this earlier but it seems to work well. Nice job. Great script. :) What script is that you were running here? Is the 1st terminal an Arch linux thing, or script? (Or is that Haggis Script?) Link to comment Share on other sites More sharing options...
Yorak Posted October 14, 2013 Share Posted October 14, 2013 What script is that you were running here? Is the 1st terminal an Arch linux thing, or script? (Or is that Haggis Script?) I am fairly sure it is glances. the evn show and Class 2 Share Link to comment Share on other sites More sharing options...
Haggis Veteran Posted October 15, 2013 Author Veteran Share Posted October 15, 2013 I am fairly sure it is glances. The one on the right is version 1of my stats script Link to comment Share on other sites More sharing options...
BinaryData Posted May 20, 2016 Share Posted May 20, 2016 @Haggis Have you tested this with CentOS? I'm trying to find an easy and lightweight way of logging how much bandwidth I use, and what files are being downloaded. I've got seedboxes I need to run scripts on. Link to comment Share on other sites More sharing options...
Haggis Veteran Posted May 22, 2016 Author Veteran Share Posted May 22, 2016 Not used centos but it should work fine It wont log anything though it just displays real time Link to comment Share on other sites More sharing options...
BinaryData Posted May 22, 2016 Share Posted May 22, 2016 28 minutes ago, Haggis said: Not used centos but it should work fine It wont log anything though it just displays real time Would you be able to add a bandwidth logger? After 24 hours record it, at the end of the month it displays the total bandwidth used. Trying to figure out how to do that, and have those stats posted on our website. I suck at coding right now Link to comment Share on other sites More sharing options...
Haggis Veteran Posted May 24, 2016 Author Veteran Share Posted May 24, 2016 it would mean running the script in the back ground or taking a snapshot sort of like a "bandwidth used since last run" there are much better apps for this though Link to comment Share on other sites More sharing options...
Recommended Posts