Jump to content



Photo

Application: Linux System Script


  • Please log in to reply
70 replies to this topic

#46 +bman

bman

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 03-January 03
  • Location: Ottawa, Ontario
  • OS: Windows 8.1 & Android

Posted 02 January 2013 - 21:18

I have tried it both ways without luck.

And no option like that in my file manager. Default Ubuntu 12.04...

Best file manager? Any out there with tabs?


#47 +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 02 January 2013 - 21:49

I have tried it both ways without luck.

And no option like that in my file manager. Default Ubuntu 12.04...

Best file manager? Any out there with tabs?


Nautilus - the default file manager in Ubuntu - is my favorite file manager, and it does have tabs. You can either go to "File->New Tab" to open a new tab or use the keyboard shortcut "Ctrl+T". You can also add an "Open in Terminal" option to the Nautilus context menu as described here.

#48 +bman

bman

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 03-January 03
  • Location: Ottawa, Ontario
  • OS: Windows 8.1 & Android

Posted 02 January 2013 - 21:54

Thanks guys, got the open in terminal working, and got the script working with that.

Awesome!

#49 OP Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 02 January 2013 - 22:53

post a screenshot if u can :)

#50 +bman

bman

    Neowinian Senior

  • Tech Issues Solved: 1
  • Joined: 03-January 03
  • Location: Ottawa, Ontario
  • OS: Windows 8.1 & Android

Posted 03 January 2013 - 00:47

Just a fresh install. Will post in that thread :)

#51 +Majesticmerc

Majesticmerc

    Resident Idealist

  • Tech Issues Solved: 8
  • Joined: 24-August 05
  • Location: United Kingdom
  • OS: Arch Linux / Win 7
  • Phone: HTC One X

Posted 06 January 2013 - 23:17

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"?

#52 +Karl L.

Karl L.

    xorangekiller

  • Tech Issues Solved: 15
  • Joined: 24-January 09
  • Location: Virginia, USA
  • OS: Debian Testing

Posted 07 January 2013 - 03:31

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!

#53 OP Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 07 January 2013 - 11:05

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

and also tell me the Distro your running

#54 yxz

yxz

    Neowinian Senior

  • Joined: 11-January 09

Posted 07 January 2013 - 11:21

archlinux
Arch Linux \r (\l)


#55 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 17
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 07 January 2013 - 11:59

can you post the output of

cat /etc/issue


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.

#56 OP Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 07 January 2013 - 12:03

ok so cant rely on /etc/issue either lol

Max does my script pick up Gentoo ok?

#57 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 17
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 07 January 2013 - 12:15

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.

#58 OP Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 07 January 2013 - 12:21

hmmmm i remember now lol

#59 Max Norris

Max Norris

    Neowinian Senior

  • Tech Issues Solved: 17
  • Joined: 20-February 11
  • OS: Windows 8.1, BSD Unix
  • Phone: HTC One (Home) Lumia 1020 (Work)

Posted 07 January 2013 - 14:15

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.|	 <img src='http://www.neowin.net/forum/public/style_emoticons/<#EMO_DIR#>/noekspression.gif' class='bbc_emoticon' alt=':|' />	 `|::`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.)

#60 OP Haggis

Haggis

    Neowinian Senior

  • Tech Issues Solved: 12
  • Joined: 13-June 07
  • Location: Near Stirling, Scotland
  • OS: Debian 7
  • Phone: Samsung Galaxy S3 LTE (i9305)

Posted 07 January 2013 - 14:56

ok so what does this give you

cat /proc/cpuinfo | grep 'model name