I am running a telnet script that connects to a database server and executes sql scripts. While the remote database is processing the commands within the sql scripts, my telnet script continues to send commands. Okay, that's fine. They get queued up in the remote server and executed sequentially. However, once the telnet script sends the last command, the script ends and the session closes. All of the commands that were queued up while the remote server was busy processing, never get run.
Here is the outline of my code:
Sample Output
[remoteHost]$ ..execute script1.sql
script1.sql commands running running running
..execute script2.sql
..execute script3.sql
..execute script4.sql
..execute script5.sql
..execute script6.sql
exit
Connection closed by foreign host.
[localHost]#
This shows one command is being run while the others are being pushed into the stack, but the telnet script exits before they get run.
What doesn't work:
I cannot use expect because this script is to be used on many machines which do not have expect installed, I don't want to bother with installing expect on all of them.
I tried using read myVar, read -p myVar, echo "read myVar", echo "read -p myVar". These work on korn but don't work on bash in this situation. It just skips right through to exit.
I would prefer not to set a ridiculously high sleep value as a solution. The point of this script is to save time, not waste it in sleep.
Ideal Solution
Ideally I would like my telnet script to wait until the remote server has finished executing the sql scripts, then exit without user input.
I put this thread to shell and bsd, because I want to resolve this matter on bsd.
May somebody can explain to me how to ping a remote server, in unix. BTW the following code examples were tried on a linux system as well, with the same output, nothing. But on my bsd are not installed nmap neither... (4 Replies)
Hi,
Given addresses of 2 remote machines, using a shell script is it possible to
get the state of running processes in "src"
stop all the processes in "src"
exit out of "src"
ssh into "dest"
resume the state of executing processes captured in step 1 in "dest"
Assumption:
"src" is... (3 Replies)
Hi I'm trying to create a basic script that pauses for user input to verify a file name before generating the output.
I have numerous SSL certificate files which I am trying to determine the expiry date so what I'm trying to do is write a script so that is pauses to request the name of the .pem... (9 Replies)
All,
Is there some way to have my KSH script pause, until the word "DONE!" appears in the logfile /logs/log.txt?
Difficulty: The word "DONE!" may already be present in logs from the past. So I anticipate tail -0f may (somehow?) need to be done in the background, instead of grepping in a... (16 Replies)
Hi,
My requirement - for security purpose -
I want all root logins to my solaris servers are done by a script kept
in a separate unix box. This script will telnet into remote solaris server with
root user and log every session via log file.
Now my purpose is to log every telnet session... (3 Replies)
Hi,
I've written a shell script to take photos with my camera.
After every picture taken, the picture is transmitted to the computer via usb and then deleted on the camera.
But sometimes there's an error and the picture is not deleted and so, after a certain time, the camera chip will be... (4 Replies)
Alright, I have this script that pulls files from a few locations, process those files, creates a zip file, rsync's it and then removes everything.
The problem that I'm having is that I do not know how large the rsync'ed zip file is going to be. Right now I'm using a sleep command before I... (4 Replies)
Hi all,
i am trying to remotely execute a script from a different server.
this is the code that i use :
#!bin/sh
pwd
(sleep 1 echo "username"
sleep 2 echo "pwd"
sleep 2 echo "cd /path/to/file"
if
then
echo "script1.sh"
echo "mailx -s "Task Executed"... (1 Reply)
Hi every1
well i am new to unix scripting but i have been seeking help from this forum
the question
i want to write a script to telnet to a remote server
and put the username and pwd in the script
the problem is that i want to run some commands on the remote server and get the results in a... (2 Replies)
I have been using rsh, and vnc to access my computer from outside my network. I can do all the simple browsing's but when i go to start or stop apache httpd, or some other deamon commands I am running into problems. I log in as a standered user and the use % su to switch over to root. However,... (4 Replies)