Execute scripts from remote using telnet


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Execute scripts from remote using telnet
# 1  
Old 08-01-2008
Question Execute scripts from remote using telnet

Hi

having the below code
Code:
(sleep 1 echo "username"
 sleep 2 echo "password"
 sleep 2 echo "cd /home/test1/path"
 sleep 10 echo "ls -l | grep filename"

if exists
echo "script1.sh filename"
echo "mailx -s "Task Executed" user@domain.com"
else 
echo "mailx -s "File not Exist" user@domain.com"

echo "exit" ) | telnet server1

Need to know wat kind of condition statement to use for this scenario.

Thanks with anticipation
# 2  
Old 08-01-2008
You can use if [ -x ./script1.sh ] to test whether it is present and executable.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to execute telnet commands thru xterm?

I want to launch an xterm telnet window: xterm -e telnet xxx.xxx.xx.xxx Which I can do but needs to also launch commands as well. Please use CODE tags as required by forum rules! (2 Replies)
Discussion started by: shopgirl08
2 Replies

2. Shell Programming and Scripting

Sudo connect to a remote server and execute scripts in remote server

Hello Every one!! I am trying to write a shell script which will connect to a remote server and execute scripts which are at a certain path in the remote server. Before this I am using a sudo command to change the user. The place where I am stuck is, I am able to connect to the... (6 Replies)
Discussion started by: masubram
6 Replies

3. Shell Programming and Scripting

Telnet using port and execute cmd

Hi, my query is: I am Login on server with IP xxx.xxx.xxx.xxx.. and i want a script where i want to telnet to server with IP yyy.yyy.yyy.yyy using specific port and then execute a cmd there on server Y please suggest (1 Reply)
Discussion started by: dodasajan
1 Replies

4. Shell Programming and Scripting

how do i execute a set of commands in telnet??

I have list of commands in a file in one sever and i need to execute these set of commands in the server to which i m telnetting to .. (4 Replies)
Discussion started by: nikhil jain
4 Replies

5. Shell Programming and Scripting

Telnet to router and execute command

I am trying to write a shell script to execute some commands.. telnet <IP address of the router> wait 10 echo "username" echo "password" sh log exit but i am unable to execute it properly ..please help me .. thanks in advance Sri (1 Reply)
Discussion started by: srikanthus2002
1 Replies

6. UNIX for Dummies Questions & Answers

Only execute telnet and ping for user

Hello for all! This is the situation: I must create many users that only can execute telnet and ping. Create users is not a problem, but I donīt know how limit the users privileges, to only execute telnet and ping. I hope you can help me. Thank's for all. Bye :) PD: Sorry for my... (4 Replies)
Discussion started by: bobbasystem
4 Replies

7. Shell Programming and Scripting

Execute scripts on remote server

Hi All, I need to first of all establish a connection to remote unix server non-interactively with the help of a shell script and then connect to oracle database from that server all with this script of mine. Please suggest the best method which could be used to connect to server for executing... (1 Reply)
Discussion started by: m_kapur83
1 Replies

8. Shell Programming and Scripting

Script to connect to a remote server and execute scripts

Hello All I need a script or set of commands which can establish a remote connection with another server and execute some scripts over there. Basically it has to establish the connection with the remote server as an user ,say 'testuser' and then execute the script 'testscript'. and return the... (5 Replies)
Discussion started by: sgbhat
5 Replies

9. Shell Programming and Scripting

Execute Loop in Telnet

hi Everyone , have a nice day #!/bin/sh ( sleep 1 echo "LOGIN:username:password;" sleep 1 while IFS= read -r line do #echo $line GET:VOUCHERDETAIL:VoucherSerialNumber,$line; >> /home/status_log done < /home/status.txt sleep 1 echo "LOGOUT;") | telnet 127.0.0.1 7021 , it... (2 Replies)
Discussion started by: Dastard
2 Replies

10. Shell Programming and Scripting

Need to execute 2 scripts, wait, execute 2 more wait, till end of file

:cool: I need to execute a shell script to do the following: cat a file run two back ground processes using the first two values from the file wait till those background processes finish run two more background processes using the next two values from the file wait till those background... (1 Reply)
Discussion started by: halo98
1 Replies
Login or Register to Ask a Question