I do not see a syntax error, but you should correct the shebang (1st line) to
Maybe you are on Solaris and failing to run /bin/bash falls back to /bin/sh that does not understand $( )
There is a second problem,
> "test.log"
overwrites the file each time.
Either change to
>> "test.log"
Or move it to the "done" as follows
that is more efficient because it opens+creates the file once (when the loop starts).
Or
That opens+appends it once.
Hi. I have a kornshell script that runs on a daily basis as a cron job. Part of what the script does is copy the folder contents from another server to the current server (server where KSH script is running).
I have a scp command, as follows:
scp $REMOTE_HOST:$REMOTE_FILE_DIR/* $TMP_DIR
... (8 Replies)
Hi,
I am new to Shell Scripting. Can anybody help me in writing a Script Which Could Login from a Unix box to a Remote Unix box which accepts the user credentials automatically and display the result for checking the Disk Space Utilisation (Without running any SSH agent). (1 Reply)
Hi all,
I'm writing a script that chooses the best computer available in an open lab. The script works great except every now and then there is a dead computer in the lab that begins the ssh handshaking, but freezes after the following:
debug1: Offering public key:
When the script happens... (2 Replies)
Hello there.
I'm fairly new to Linux, but I am connecting via SSH and PuTTY to a remote server, and I am running a fairly heavy MySQL script in a PHP page.
Our connection here is dodgy to say the least and I get continuous disconnections.
My question is, when I get disconnected, does my... (4 Replies)
Hi all,
Im new at scripting and i need to run a few commands at work every hours so i decide to make a script but on 1 of the steps i have a the follwoing problem:
The command i do is this:
#!/bin/bash
ssh root@asdasd001 'mysql -h A-db-1 -uroot -password --execute "show slave status"'... (3 Replies)
Hello;
I regularly run monitoring scripts over ssh to monitoring scripts
But whenever a server is hung or in maintenance mode, my script hangs..
Are there anyways to trap exit status and be on my way ??
Looked at the ssh manpage and all I can see is a "-q" option for quiet mode ..
Thank... (2 Replies)
Hey,
I need a script that tries to connect via SSH to a remote server
and that remote server might not be up yet, so retry until succeed
the error message I get if the server is not up yet is:
ssh: connect to host 127.0.0.1 port 40001: Connection refused
any idea of a good way to do it ?
... (5 Replies)
Dear Folks,
I am trying to read a config file contains ip and port numbers.
i want to read each line of the config file and check ssh connection is happening or not.
Kindly guide.
Config file:
abc@1.2.342 22
abc@1.2.343 22
abc@1.2.344 22
abc@1.2.345 22... (9 Replies)
Hello guys!
I am setting up a script to access a unix remote server. My problem is that when I put the ssh line "my host", the script does not wait for the server response asking for the password to execute the line in which I put the password, that is, I need to put a form in which script has a... (1 Reply)