07-17-2008
telnet and run scripts
Hello folks,
I've got this script which connects to different boxes and executes a certain script in those locations. The following is the line from where i am trying to do this:
(sleep 1; echo $USERID ; sleep 1; echo $PASSWD ; sleep 1 ; echo y ; sleep 1 ; echo "\r" ; sleep 1 ; echo "cd $FILEPATH" ; sleep 1 ; sleep 1 ; echo "./MessageCount.sh $BOXNAME $PATHNAME $FILENAME |&" ; sleep 80)| telnet $SERVER
Do i actually need to give the 80 seconds sleep time since it is running in the background?
The other (real) problem that i am facing is that the connection to the boxes are getting closed even before the scripts have finished running.
Thanks a lot.
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
ssh user@host -q -n 'grep `hostname` /etc/hosts; telnet 10.100.23.45 1234;'
When i run this command remotely it is hanging and not giving me the prompt, Can anyone tell me how can I exit a telnet command remotely please.
Thanks. (10 Replies)
Discussion started by: venu_nbk
10 Replies
2. SCO
hi ,
i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies
3. Cybersecurity
hi ,
i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies
4. Windows & DOS: Issues & Discussions
hi ,
i need a telnet server for dos(telnet from unix server to dos client) , so how can i run telnet service on dos ? (0 Replies)
Discussion started by: shrb78
0 Replies
5. Shell Programming and Scripting
Hi
having the below 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"... (1 Reply)
Discussion started by: karthikn7974
1 Replies
6. Shell Programming and Scripting
Hi,
Can someone please send me a sample script to login to a specific device and do someme command then logout.
Thanks.. (3 Replies)
Discussion started by: rbn1226
3 Replies
7. Windows & DOS: Issues & Discussions
Hi,
I am new to scripting & i want to write a script to fetch some report.
For an example i am having a windows server which is having n number of child devices itself..I know all the Ip address of the child devices..
I wnt to login into all the child devices & fire a command & finally i need... (5 Replies)
Discussion started by: wellington
5 Replies
8. Shell Programming and Scripting
I want to connect to a remote host using telnet
there is no username/password verification
just
telnet remotehost
then I need to input some commands for initialization
and then I need to repeat the following commands:
cmd argument
argument is read from a local file, in this... (1 Reply)
Discussion started by: esolve
1 Replies
9. Shell Programming and Scripting
( sleep 3
echo ${LOGIN}
sleep 2
echo ${PSWD}
sleep 2
while read line
do
echo "$line"
PID=$?
sleep 2
kill -9 $PID
done < temp
sleep 5
echo "exit" ) | telnet ${HOST}
while is executing only command and exits. (5 Replies)
Discussion started by: sooda
5 Replies
10. UNIX for Dummies Questions & Answers
I am from MQ/MB technology. My requirement is to display the queue manger and broker status on daily basis.
If I manually run the script, it works fine and displays output. But when I have scheduled the same using cronjobs it shows only the queue manger status and not the broker status.
Can... (3 Replies)
Discussion started by: Anusha M
3 Replies
LEARN ABOUT DEBIAN
sleepenh
SLEEPENH(1) General Commands Manual SLEEPENH(1)
NAME
sleepenh - an enhanced sleep program.
SYNOPSIS
sleepenh [initial-time] sleep-time
DESCRIPTION
sleepenh is a program that can be used when there is a need to execute some functions periodically in a shell script. It was not designed
to be accurate for a single sleep, but to be accurate in a sequence of consecutive sleeps.
After a successful execution, it returns to stdout the timestamp it finished running, that can be used as initial-time to a successive exe-
cution of sleepenh.
OPTIONS
There are no command line options. Run it without any option to get a brief help and version.
ARGUMENTS
sleep-time is a real number in seconds, with microseconds resolution (1 minute, 20 seconds and 123456 microseconds would be 80.123456).
initial-time is a real number in seconds, with microseconds resolution. This number is system dependent. In GNU/Linux systems, it is the
number of seconds since midnight 1970-01-01 GMT. Do not try to get a good value of initial-time. Use the value supplied by a previous exe-
cution of sleepenh.
If you don't specify initial-time, it is assumed the current-time.
EXIT STATUS
An exit status greater or equal to 10 means failure. Known exit status:
0 Success.
1 Success. There was no need to sleep. (means that initial-time + sleep-time was greater than current-time).
10 Failure. Missing command line arguments.
11 Failure. Did not receive SIGALRM.
12 Failure. Argument is not a number.
13 Failure. System error, could not get current time.
USAGE EXAMPLE
Suppose you need to send the char 'A' to the serial port ttyS0 every 4 seconds. This will do that:
#!/bin/sh
TIMESTAMP=`sleepenh 0`
while true; do
# send the byte to ttyS0
echo -n "A" > /dev/ttyS0;
# just print a nice message on screen
echo -n "I sent 'A' to ttyS0, time now is ";
sleepenh 0;
# wait the required time
TIMESTAMP=`sleepenh $TIMESTAMP 4.0`;
done
HINT
This program can be used to get the current time. Just execute:
sleepenh 0
BUGS
It is not accurate for a single sleep. Short sleep-times will also not be accurate.
SEE ALSO
date(1), sleep(1).
AUTHOR
This manual page was written by Pedro Zorzenon Neto.
2008/04/20 SLEEPENH(1)