Jump to content

magikman

Members
  • Content Count

    63
  • Joined

  • Last visited

  • Days Won

    1

Posts posted by magikman

  1. Howdy,

     

     

     

    I am writing a shell script for users with no knowledge of UNIX. The script will be used as their shell and will give them options on things to do/execute. I need to allow them to telnet, ssh, etc. to devices. The following is what i have so far:

     

    #!/bin/sh
    #set -x
    user=`whoami`;
    CLEAR=`which clear`;
    TELNET=`which telnet`;
    MENU=/usr/local/query/menu;
    SSH=`which ssh`;
    
    _Menu ()
    {
    	$CLEAR;
    	echo " "
    	echo "		============================================================"
    	echo "								 NS2 MENU						   "
    	echo "		============================================================"
    	echo "		   1. Telnet to a Device		  12. CMTS Intfc Modem Count"
    	echo "		   2. SSH to a Device			 13. Ping/Traceroute Device"
    	echo "		   3. Clear SSH Known Hosts	   14.  "
    	echo "		   4. Access Core1 GSR			15.  "
    	echo "		   5. Access Core2 GSR			16.  "
    	echo "		   6. Access Core3 VXR			17.  "
    	echo "		   7.							 18.  "
    	echo "		   8.							 19.  "
    	echo "		   9.							 20.  "
    	echo "		  10.							 21.  "
    	echo "		  11. Access Server			 22.  "
    	echo "		============================================================"
    	echo "					Select a Menu Number Option	  "or"		   "
    	echo "				 Type  H# for Help on a Menu Option  "or"		   "
    	echo "						--Q  to Quit Menu--						 "
    	echo "		============================================================"
    	echo -n "Enter Menu Option ======> "
    	read option;
    
    	case "$option" in
    
    			1)
    					_telnet;
    		   ;;
    
    			2)
    					_ssh;
    		   ;;
    
    			3)
    					_clearssh;
    		   ;;
    
    			4)
    					_core1;
    		   ;;
    
    			5)
    					_core2;
    		   ;;
    
    			6)
    					_core3;
    		   ;;
    
    			11)
    					_aov;
    		   ;;
    
    			12)
    					_mdmcnt;
    		   ;;
    
    			13)
    					_pingtrace;
    		   ;;
    
    			*)
    					$CLEAR;
    					echo -e "You chose an invalid response. Please try again.\n Press any key to continue.";
    					read junk;
    					$MENU
    		   ;;
    
    			esac
    }
    
    _telnet ()
    {
    	$CLEAR;
    	echo -n "Enter IP address of device and press Return: ";
    	read host;
    	$TELNET $host;
    }
    _ssh ()
    {
    	$CLEAR;
    	echo -n "Enter IP address of deivce and press return: ";
    	read host;
    	$SSH $host
    }
    
    _clearssh ()
    {
    	$CLEAR;
    	echo -e "Know hosts has been cleared.\n Press any key to continue.";
    	read junk;
    	$MENU;
    }
    
    _core1 ()
    {
    	$CLEAR
    	$TELNET <someIP>
    
    }
    _core2 ()
    {
    	$CLEAR
    	$TELNET <someIP>
    }
    _core3 ()
    {
    	$CLEAR
    	$TELNET <someIP>
    }
    _aov ()
    {
    	$CLEAR
    	$SSH 216.54.59.140
    }
    _Menu

     

    The problem i am having is that after remoting into another box, i lose the shell script as the shell when they come back. If anyone has any suggestions, i am all ears (znx).

  2. PROBLEM: Not able to connect to internet using cable modem in Fedora 8.

     

    System Details:

     

    * Laptop, Turion64, 1.25GB RAM

    * Fedora 8, 32 bit (386 distribution)

     

    Windows Scenario:

     

    * I use Hathway Cable Model connection to connect to internet. I successfully connect to internet from Windows-Vista. (Dual Boot laptop, Fedora8/Vista)

    * I need to set Static IP address, Subnet mask, Gateway and DNS addresses in Windows, and I get connected, without any username/password/login or hostname.

    * Typical settings are as follows:

    IP: 125.99.69.???

    Subnet: 255.255.255.0

    Gateway: 125.99.68.1

    DNS: 202.88.130.67; 202.88.130.15; 202.88.130.5

    * Once these settings are made in windows, internet is up and running.

     

    Fedora8 Scenario:

     

    * Set IP address and gateway using "system-config-network" gui tool ("Administration -> Network -> eth0 ->Edit" from menu). Routes tab for "eth0 -> edit" are kept empty.

    * In gui tool that appears after "Administration -> Network" menu, in its DNS tab, set all the three DNS addresses.

    * Restarted the computer but no connection to internet.

    * "ifconfig eth0" shows static IP.

    * Static IP can be pinged.

    * route -n command shows Network: 125.99.69.0 and gateway 0.0.0.0.

    * So I think, the problem is related to setting up gateway. "route add default gw 125.99.68.1" command doesn't work, it shows, "no such process".

    * Of course Gatway IP cannot be pinged.

    * I tried to install LinuxConf gui utility, but its TextBoxes appear not in regular fashion, and does not allow editing. Tried to use it in text mode, but still no use.

     

    If you or any of your friend could solve this problem, it will be really very helpful to me. Thanks a lot in advance.

     

     

    I believe that the "no such process" actually means that the gw that you are trying to use isn't on the same network as your linux computer (crappy error msg, huh?) Could you please post the output of "ifconfig eth0" and the 'route' command?

  3. mydestination = $myhostname, $mydomain, localhost.$mydomain, localhost

     

    Postfix is also very good at fighting spam without the need for different programs/scripts. Use the following in your config to use RBLs:

     

    smtpd_recipient_restrictions = permit_sasl_authenticated,

    permit_mynetworks,

    reject_unauth_destination,

    reject_rbl_client zen.spamhaus.org,

    reject_rbl_client cbl.abuseat.org,

    reject_rbl_client bl.spamcop.net,

    permit

     

    You can also do header checks and a whole host of other things. It can do lots of cool stuff.

     

    :P

  4. I don't know if syslog-ng can do that or not. What i would do is write something in perl to parse the log file every 5-10 minutes and look for that keyword. If it is there, send the lines which contain it to an email account. If you need it i can write something for you to do just that.

  5. [root@IS-3086 rdesktop-1.5.0]#

     

    If you see the # above, that means you are root. Type 'exit' at the prompt and retry that command. If it doesn't work then, we will try something different.

    • Like 1
  6. Hola,

     

    I have to convert a ass load of rrd files to xml to be imported via a newer version of rrd. The way i was thinking of doing this was to use the following script:

     

     

    for rrd in `find / -type f -name "*.rrd"`
    do
    	  echo "Converting $rrd"
    	  rrdtool dump $rrd > $rrd.xml
    done

     

    I haven't tested that yet, that was just my initial thoughts on doing this. What are your thoughts? After converting them, i was going to use rsync to send all the xml files over to the new server. Once on the other side, i was going to use something very similar to the above to convert the files back to rrd format. Ritter and znx, what are your thoughts on this?

  7. Hola,

     

    During my first few weeks at my new job noticed that their backup solutions are really outdated or are simply non-existent. They currently have a large tape library that is connected to Backup Exec which is meant to do backups for the entire server farm. However, currently this system isn't connected to the network in such a way that will allow me to backup remote servers. So, I have two solutions for that problem.

     

    1) Build an ATM circuit from the remote locations to the local tape library over a private 172 address space. The problem with this is that the ATM link will only be ~500M and there are ~5 servers to be backed up via this method. (~$23K)

     

    2) Build a SAN at the remote location and have the backups for the remote servers created locally to that server location. This system would use iSCSI over an existing Ethernet infrastructure and thus would be considerably faster than the WAN link. This solution would provide storage expansion and facilitate much faster backups. (~$20K)

     

    I am leaning toward the second solution to this issue. The backups would be much faster and it would be way easier to recover files from a local server rather than a remote library. However, the only issue I am looking at is the variety of servers which need to be backed up. We have a combination of Linux and Sun 2.7,8 and 10 servers.

     

    Do any of you have a setup like this? How are you doing your backups? What types of systems are you using/running? If you are using a SAN, what are you using? I am looking at the PowerVault MD3000i.

     

    Anyweb, could you get me some information on the MD3000i or put me in contact with someone that can provide me some in depth technical information on it (maybe even you)? If so, please PM me and I will send you my work email.

  8. Hello -

     

    Thanks for reading. Using linux live cd's, the dd command, and the new ntfsprogs package, I have managed to make a bit-by-bit clone of my Vista operating partition. This cloning was done to an external USB drive.

     

    The reason I did this is so that I can reimage the Vista partition back to the internal hard drive in less than 10 minutes, instead of going through the mega-long factory restore process provided by the OEM manufacturer's restore partition.

     

    So now I have an 8,756 MB clone sitting on the external hard drive, and I am wondering: Is there a way to now copy this 8,756 bit-by-bit to DVD media?

     

    This would give me an optical backup of the bit-by-bit lay down, just in case I ever lost the backup partition on my USB external hard drive. Instinct tells me this is not possible because of the way optical media is read/write.

     

    Thanks for any insights!!

     

     

    Yes, dd can do this and many, many others. I keep this page in my bookmarks as a reference:

    http://www.linuxquestions.org/questions/li...command-362506/

  9. I went against both of your suggestions and went with my own comfort. I ended up using dd to do the initial copy and rsync to do a nightly backup of the dynamic content on the server. All went really well.

     

    Thanks for your input, znx!

  10. Hello,

     

    This past week I started a new job with a rather large ISP maintaining their servers. One of the servers I have been put in charge of runs a captive portal system for a rather large convention center. This convention center has vendors come in and rent bandwidth/service. At this site I have two servers, one old and one current. As of right now there isn't any backing up of the current server, this scares me. What i would like to do is somehow clone the current server to the old and then use rsync to do incremental backups very early in the morning of the dynamic content on the drive. I was thinking of cloning the data on the HD of the current server via the use of dd or just tar'n all the directories. If using dd, i would just place the old server's drive in with the new server and dd the content to the old drive. However, if using tar and a custom script, i would just place the old drive in with the new server and tar the directories and untar them on the old drive leaving the MBR intact.

     

    If any of you have ever done anything like this, please let me hear how you accomplished this.

     

     

    Thanks!!

  11. Lets be honest, everyone at some point has to dive into the shell under Linux. It could be a rather boring and annoying trip if your shell prompt is just:

    znx $

     

    Not only is that unhelpful its *YAWN* So how to spice it up .. well simple, take a look at moveax's quick introduction into how to do it.

     

    Mine is rather simple looking at the moment:

    mark@tone ~ %

     

    The first bit is simply, my username at the hostname. Then the current working directory.

     

    Hrrrm, time to spice it up again I think :)

    His tutorial looks very, very familiar! I wonder where he got that idea! <_>

  12. There is a few guys in the forums (one of which is me) who are capable scripters. One of the things that you will learn to enjoy with Linux is how to script. If you do something with your machine everyday, if you click on 10 buttons when ever you login, then a script is what you need.

     

    Scripts are in essence the heart and sole of a UNIX/Linux system, they represent the way that the system is designed. Each tool has a specific purpose and is created to only undertake that purpose. For instance "cat" can only do one job, it can't suddenly start doing "rm", in comparison under Windows when tools are built they regularly do multiple jobs.

     

    So under Linux what you need is a glue and that is scripts.

     

    If you have any requests, any queries, any wishes.... then ask and we can but try to find a solution for you.

     

    This is a great idea and an awesome way to improve your scripting skills!

×
×
  • Create New...