Shell Scripting [Linux] menu

User Tag List

Results 1 to 2 of 2
  1. #1
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)

    Shell Scripting [Linux]

    Well I coded this out for a friends and was thinking this could help someone els. If you have any quests just ask. It is a simple little script for Linux. I coded it out for Fedora. Anyways, have fun!

    Code:
    #!/bin/bash
    #
    # - Sysprofile Script
    #
    outputfile="Report-[`date '+%b.%d.%H:%M'`].txt"
    tempfile=Temp.txt
    
    #==================================================================================
    #=========[  Sysinfo - s ]=========================================================
    #==================================================================================
    if [ "$1" == "-s" -o "$1" == "-a" ]; then
    #{
    
    	echo "-----------------------------------------------------------------------------"
    	echo "Hostname: `hostname`"  							
    	echo "Kernel: `uname -r`" 							
    	echo "Distro: `cat /etc/issue | grep -m 1 ''`" 					
    	echo "Runnung: `uptime | awk '{print $3}' | tr -d /,`" 	
    	echo "-----------------------------------------------------------------------------"	
    #}
    fi
    
    #==================================================================================
    #=========[  sysinfo - h ]=========================================================
    #==================================================================================
    if [ "$1" == "-h" -o "$1" == "-a" ]; then
    #{
    	echo "-----------------------------------------------------------------------------"
    	echo "Num CPUs: `cat /proc/cpuinfo | grep -c processor`"			
    	echo "CPU Model: `cat /proc/cpuinfo | grep -m 1  'model name' | cut -d: -f2`" 	
    	echo "RAM: `free -m -t | grep 'Mem' | awk '{print $2}'` MB" 			
    	echo "Free Ram: `free -m -t | grep 'Mem' | awk '{print $4}'` MB" 	
    	echo "Used RAM: `free -m | grep 'Mem' | awk '{print $3}'` MB" 	
    	echo "-----------------------------------------------------------------------------"	
    #}
    fi
    
    #==================================================================================
    #=========[  sysinfo - n ]=========================================================
    #==================================================================================
    num=`ip add | grep -c ': '`
    count=1
    
    if [ "$1" = "-n" -o "$1" = "-a" ]; then
    #{
    	echo "-----------------------------------------------------------------------------"
    	until [ "$num" = "$count" ]
    	do
    	  echo "`ip add | grep -m 1 -A 3 $count:`" > $tempfile
    	  
    	  NAME=`cat $tempfile | grep -m 1 $count: | awk '{print $2}'`
    	  IP=`cat $tempfile | grep -m 1 'inet ' | awk '{print$2}'`
    	  MAC=`cat $tempfile | grep -m 1 'link/' | awk '{print $2}'`
              
    
    	  if [ "$IP" = "" ]; then
    		IP="000.000.000.000/0" 
    		echo -e "$NAME  `` $IP  ``\t`` $MAC"
    	  else
    		if [ "$IP" = "127.0.0.1/8" ]; then
    	  		echo -e "$NAME  ``\t`` $IP  ``\t````\t`` $MAC"
    	  	else
    			echo -e "$NAME  ``\t`` $IP  ``\t`` $MAC"
    	  	fi		
    	  fi
    
    	  
    	  shift
    	  count=`expr $count + 1`
    	done
    
    	echo "-----------------------------------------------------------------------------"
    	echo "`route`" 									
    	echo "-----------------------------------------------------------------------------"
    #}
    fi
    
    #==================================================================================
    #=========[  sysinfo - f ]=========================================================
    #==================================================================================
    if [ "$1" == "-f" ]; then
    #{
            ./sysprofile -a > $outputfile
    	echo $outputfile
    #}
    fi
    
    #==================================================================================
    #=========[  sysinfo - help ]======================================================
    #==================================================================================
    if [ "$1" == "--help" -o "$1" == "-help" ]; then
    #{
    echo "Useage: sysinfo [OPTION]"
    echo ""
    echo "	-s		Hostname, Kernel, Distro and Runnung Time"
    echo "	-h		Num CPUs, CPU Model, RAM, Free Ram, Used RAM"
    echo "	-n		Int Name, Ip Address, MAC and Routing Table"
    echo "	-f		Combination of '-s', '-h', '-s'" 
    echo "				--To 'File-Report-[TIME].txt'"
    echo "	--help		Sytinfo Options"
    echo ""
    #}
    fi
    
    #==================================================================================
    #=========[  CleanUp  ]============================================================
    #==================================================================================
    `rm -f $tempfile`

    Shell Scripting [Linux]
  2. #2
    DarkLinux's Avatar Former Staff
    CoreCoins Purchaser Authenticator enabled
    Reputation
    1627
    Join Date
    May 2010
    Posts
    1,846
    Thanks G/R
    193/539
    Trade Feedback
    16 (100%)
    Mentioned
    7 Post(s)
    Tagged
    0 Thread(s)
    Code:
    #!/bin/bash
    
    count=1010
    userid=1000
    
    until [ "$userid" = "$count" ]
    do
    	
    	`groupadd NET$userid -g $userid`
    
    	`useradd netuser$userid -g $userid -d /home/NET$userid -u $userid -s "/bin/bash" -p "just2day"`
    	  
    shift
    	userid=`expr $userid + 1`
    done

    Code:
    #!/bin/bash
    
    count=1010
    userid=1000
    
    until [ "$userid" = "$count" ]
    do
    	
    	`userdel netuser$userid`
    
    	`groupdel NET$userid`
    	  
    shift
    	userid=`expr $userid + 1`
    done
    Last edited by DarkLinux; 02-10-2011 at 03:05 PM.

Similar Threads

  1. Compiling custom scripts on Linux
    By pcrew in forum WoW EMU Guides & Tutorials
    Replies: 0
    Last Post: 10-30-2009, 10:38 AM
  2. [Linux] MaNGOS auto compiler script
    By Iksf in forum WoW EMU General Releases
    Replies: 0
    Last Post: 08-05-2009, 12:51 PM
  3. [request] Script shells [Filled]
    By louse in forum WoW EMU Questions & Requests
    Replies: 0
    Last Post: 01-05-2009, 01:07 PM
  4. Any Anti AFK Scripts available?
    By paboee in forum World of Warcraft General
    Replies: 2
    Last Post: 08-30-2006, 09:11 AM
  5. [Program] WoW Jumper AntiAFK Script
    By Cypher in forum World of Warcraft Bots and Programs
    Replies: 5
    Last Post: 06-23-2006, 10:38 PM
All times are GMT -5. The time now is 02:17 PM. Powered by vBulletin® Version 4.2.3
Copyright © 2025 vBulletin Solutions, Inc. All rights reserved. User Alert System provided by Advanced User Tagging (Pro) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Google Authenticator verification provided by Two-Factor Authentication (Free) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
Digital Point modules: Sphinx-based search