The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 03-17-2008
Wolja's Avatar
Wolja Wolja is offline
Registered User
  
 

Join Date: Feb 2002
Posts: 15
Quote:
Hi, I'm wondering if there's a way to send a command periodically to remote server through a script.

Right now I have this:

Code:
keepLooping=1
ssh user@domain
while (( keepLooping == 1 ))
do
echo a
sleep 3[/CODE]
donebut what this does is ssh to the server, and only when the connection is closed do the following commands run. What I'm trying to achieve is to automate me SSHing to the server and entering a command every xx seconds.

Any suggestions? Thanks!
I'm not quite sure what you're trying to do but your while loop is in the wrong place.

Code:
keepLooping=1
while (( keepLooping == 1 ))
do
ssh user@domain
echo a
if [ ?? ] ; then
do something
else
set keeplooping to 1
fi
sleep 3[/CODE]