May 25, 2013


Shell Script Commands to Automate Server or Host Telnet Login Session


In linux,we usually come across repeated commands which we try to automate usinng shell scripts.One such major need arises,when we need to establish a telnet session to a system and perform some repeated commands in remote server or host.
So,In order to automate the telnet sessions,you just need to copy the following code in a file (say,node_login) and place it in the home directory.

#! /usr/bin/env expect
set ip [lindex $argv 0 ]
set slot [lindex $argv 1]
set timeout -1
set node_ip $ip
if {[llength $argv] == 1} {
spawn telnet 192.168.15.$node_ip
expect "login: "
send "root\r"
expect "Password: "
send "techtips\r"
expect "$"
}
if {[llength $argv] == 2} {
spawn telnet 192.168.15.$node_ip $slot
expect "login: "
send "root\r"
expect "Password: "
send "techtips\r"
}
if {[llength $argv] == 0} {
spawn telnet 192.168.90.103
expect "login: "
send "techtips\r"
expect "Password: "
send "techtips\r"
expect "$ "
}
interact

Now add the command to your .bashrc file in your home directory.
alias node='/home/tectips/node_login'

Here,you must specify your path to your file earlier saved.So,when you type the keyword ‘node’,it will automatically login to your node with login and password you have provided in your scripts.

I have given three conditions,

i.If you type ‘node’ in your console,

command executed:   telnet 192.168.90.103

2.if you type ‘node 114′ (you have given the last substring of your ip)

command executed:   telent 192.168.90.114

3.If you type ‘node 114 1098′ (you have given last substring of your ip as well as your port)

command executed:  telnet 192.168.90.114 1098

You can change the subnet of the network as you wish by editing the scripts ,add commands after establishing telnet sessions,and enjoy automation.

Fix For WordPress 2.8.x for Google Friend Connect if not Working in Firefox 3.5

Last day i noticed that my Google-Friend connect plugin is not working for my latest wordpress.I tried a lot to find out the issues behind that.I realized that it is not a code issue since gadget is shown properly in a static page.So,there must be clashes with other plugin codes which might prevent my gadget to load up.I have been seeing  just a empty plain or white box ,nothing else.

I searched a lot,and at last found out the issue.It was a bug in Prototype JS Framework which causes it to interfere with the Native JSON parser in Firefox 3.5 and leads to the GFC-prototype conflict.[Refer Explanation]

So,Just copy this piece of code and paste it above the google-connect gadget code.The better option is ,place the code in the header.php of the wordpress code.

<script>
window.JSON = {
parse: function(st){
return st.evalJSON();
},
stringify: function(obj){
return Object.toJSON(obj);
}
};
</script>