Want to make a script that checks connection protocol


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Want to make a script that checks connection protocol
# 1  
Old 07-11-2008
Want to make a script that checks connection protocol

Hello all,

I currently connect to several servers multiple times a day. Most of the time I connect via SSH through the terminal emulator poderosa (my personal favorite), but sometimes I connect via telnet through xstart because I need it to export a GUI.

What I want to do is add something to my bashrc that will check the connection method and if it's ssh take me directly to the command line, but if it's telnet execute the command that exports the GUI (admincon).

I'm sure I can handle the scripting side of it (even if it is my general level of inelegance...) but I don't know how to check for connection protocol.

Any suggestions?
# 2  
Old 07-11-2008
One option would be to check the parents process(es) using ps to determine whether your shell was launched by sshd or inetd (most likely in the case of telnet).
# 3  
Old 07-11-2008
check for the existence of the $SSH_CONNECTION variable
# 4  
Old 07-12-2008
Yep, that's a better idea.
Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Script function which checks if itself is already running

Hi All, I have a cron job set up which is set to run every 10 seconds. What I need to do is have the script do a check to see if it is already running such that if it is running it wont fire up additional instances and processes according to its normal process. For example if I have a script... (4 Replies)
Discussion started by: landossa
4 Replies

2. Shell Programming and Scripting

Script to do the following checks

Hi , I need a script for processing below scenario. I have to check daily by doing ftp IP to check it is logging or not. So i want this activity to be automated such that if login succesful i will get "FTP LOGIN SUCCESS" in a log file and if fails i want the error message in the same log... (1 Reply)
Discussion started by: sv0081493
1 Replies

3. Shell Programming and Scripting

Script to performs checks

Hi , I need a script which performs below activity I have one file named "testfile" in 9 different directories with same name. I want to perform below action with each testfile of each directory. if ; then mv listfiles listfiles_`date +%b%y` else echo No Such files fi ... (4 Replies)
Discussion started by: sv0081493
4 Replies

4. Shell Programming and Scripting

[Bash] MD5 Checks with Script.

Hi. I'm triyng to make a Bash Script that checks (recursively) the MD5 from all the files in a certain directory and compare them against some other check that should be already done and saved in a file. I've reached to the point where i have the MD5 from the file and the MD5 that the script... (1 Reply)
Discussion started by: BiFo
1 Replies

5. AIX

How many connection can a user make?

Where do i check how many connection a same user name can make to a UNIX/AIX system. for examples root login from local physical machine root login from LAN via telnet at the same time root login from internet via telnet also at the same time.. where do i check and how do i change this ? ... (3 Replies)
Discussion started by: dplinux
3 Replies

6. Shell Programming and Scripting

Need help to make connection to various hosts

Guys If someone could help me? Basically I want to connect from my central server and run the script to remote servers (in our environment we do not need a username/password to connect); like below ssh <server_name_1> /ora/rman/scripts/bk2.sh 2>/dev/null >> /tmp/an.log ssh <server_name_2>... (3 Replies)
Discussion started by: anjum.suri
3 Replies

7. Shell Programming and Scripting

Make sure connection

We have two servers , one is mount to another server , I am worry if the server is unstable , the connection ( mount ) will be broken , or when the server is rebooted , the connection will also be broken , can advise how can I make sure the mount is establish , can advise if I want to do the below... (1 Reply)
Discussion started by: ust
1 Replies

8. Shell Programming and Scripting

Script that checks for previous instances running

Hello, I'm trying to write a script that checks for previous instances of the same script which may still be running (this script is scheduled to run every 30 minutes). I want to somehow use the pid from each instance to make sure the previous one isn't running before continuing with my... (5 Replies)
Discussion started by: bd_joy
5 Replies

9. Shell Programming and Scripting

how to make case insensitive checks????

Hi, I have tried to make the conditions similar to the below one's, perhaps, I am not sure if there are any more way's to do that???? if ) ]] echo "Whatever" fi (5 Replies)
Discussion started by: hitmansilentass
5 Replies
Login or Register to Ask a Question