Sponsored Content
Top Forums Shell Programming and Scripting Continuous checking of a file Post 302759877 by kanta_bhakti on Wednesday 23rd of January 2013 04:27:04 AM
Old 01-23-2013
That worked.Thanks bipin.

However for different server shall i remove quotes as well?

now my code looks like this:

Code:
-sh-3.2$ ./test_new.sh
File found.
-sh-3.2$ more test_new.sh
 #!/bin/bash
while :
do
        if [[ -f /home/sendhabh/trial.done ]]
        then
                echo "File found."
                break;
        else
                echo "File not found."
                sleep 10
        fi
done

---------- Post updated at 05:27 PM ---------- Previous update was at 04:43 PM ----------

I use this now..howeever i get rror as below:

Code:
-sh-3.2$ ./test_GMI_final.sh
ssh: : Name or service not known
File not found.


Code:
-sh-3.2$ more test_GMI_final.sh
#!/bin/ksh
DATEPREV=`date --date yesterday "+%d%m%Y"`
while :
do
        if [[ $( ssh -n etdmis@$xldn2218pap "ls /sbclocal/InternalSecureFileTransfer/users/ETDIT/gmi_coma/gmi_to_coma/US2COMA_
$DATEPREV.done
 2> /dev/null " | wc -l ) -ne 0 ]]
        then
                echo "File found."
                break;
        else
                echo "File not found."
                sleep 10
        fi
done


Last edited by Scrutinizer; 01-23-2013 at 05:30 AM.. Reason: code tags; code tags again
 

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Removing dupicate lines in the file ..(they are not continuous)

I have duplicates records in a file, but they are not consecutive. I want to remove the duplicates , using script. Can some one help me in writing a ksh script to implement this task. Ex file is like below. 1234 5689 4556 1234 4444 (7 Replies)
Discussion started by: Srini75
7 Replies

2. Shell Programming and Scripting

Continuous Flat file parsing

Hi all, I'm looking for some tips on an ideal method of parsing a huge fixed length flat file (~500gb) into a delimited text file. We have to do this because our data warehouse platform only accepts delimited file loads. In the past, we've done this with SAS (only on smaller ~40GB files) by... (1 Reply)
Discussion started by: cg2
1 Replies

3. Shell Programming and Scripting

Rename files with continuous numbers

I have a huge collection of HTML files. They have their own file names with htmlextension. I want to rename each of these files with continuous numbers starting from 1.html till the last count of files. Simply it means that if there are three files like this abc.html cdfhg.html rmbd.htmlthen... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

4. Shell Programming and Scripting

Continuous log file transfer to remote server

I have several production servers and 1 offline server. Production server continuously generates new log files for my application. Depending on time of day new files may be generated every few seconds and at other times every few hours. I also have an offline server where I would like to pull log... (3 Replies)
Discussion started by: yoda9691
3 Replies

5. Shell Programming and Scripting

Creating a Continuous File Reading-Executing Shell Script

I need to write something that will read and execute all the files(Mainly executable scripts) inside one or more folders; in other words, a continuous chain with a break when finished. I'm new to shell and need syntax help. I'm on Ubuntu 12.10-Gnome btw. Here are some main highlights I think... (2 Replies)
Discussion started by: linuxlololol
2 Replies

6. Shell Programming and Scripting

Detect continuous number as range

I have 100k data like this bellow , i want to group data to range 171 172 173 174 175 176 179 182 183 187 188 189 1900 1901 1903 1904 1905 1906 (10 Replies)
Discussion started by: before4
10 Replies

7. Shell Programming and Scripting

Continuous Copying from a directory to another.

Hello Folks, Looking for a script, where i can check for the existing of the files in a directory and copying to another. How can i achieve it in loop for over period of time. whatever files comes into the folder copied in another without duplicate and should be continuous loop. ... (8 Replies)
Discussion started by: sadique.manzar
8 Replies

8. UNIX for Beginners Questions & Answers

Continuous for loop

Hi All, Please help ***************** a=100 and run for loop that will minus 30 from 100 an will display value run loop will run till display value will be 0 ***************** Thanking you (1 Reply)
Discussion started by: Praful Pednekar
1 Replies
ZSSH(1) 							       ZSSH								   ZSSH(1)

NAME
zssh - interactive file transfer wrapper for ssh SYNOPSIS
zssh [zssh options] [--] [ssh options] ztelnet [zssh options] [--] [telnet options] DESCRIPTION
zssh (Zmodem SSH) is a program for interactively transferring files to a remote machine while using the secure shell ( ssh ). It is intended to be a convenient alternative to scp , allowing to transfer files without having to open another session and re-authenticate one- self. zssh is an interactive wrapper for ssh used to switch the ssh connection between the remote shell and file transfers. This is achieved by using another tty/pty pair between the user and the local ssh process to plug either the user's tty (remote shell mode) or another process (file transfer mode) on the ssh connection. ztelnet behaves similarly to zssh, except telnet is used instead of ssh. It is equivalent to 'zssh -s "telnet -8 -E"' Files are transferred through the zmodem protocol, using the rz and sz commands. zssh behaves as an usual ssh session until the escape sequence is depressed ( default is ^@ which can be produced by pressing C-space, or C-2, or C-` ), which enables file transfer mode. A new prompt is then displayed, and commands can be executed locally to initiate file transfers (among other things). It roughly behaves as a local shell featuring line edition, history and completion (thanks to libreadline), globbing, and escape characters ( " ' and ). The following builtins are handled by zssh itself: ? , cd , disconnect , escape , exit , help , hook , quit , repeat , rz , suspend , sz , version cd <dir> change current directory disconnect disconnect and exit escape [^X] Change escape key to ^X. Without argument, print current escape key exit exit file transfer mode. ^D may also be used for this purpose. help print help and tips ? hook prg [args] Hook program 'prg' on the the pty. Its standard input and output will go through the ssh channel. typing 'sz'/'rz' is in fact equivalent to 'hook sz'/'hook rz' A weird imagination is most useful to gain full advantage of this feature. quit same as exit. repeat repeats cmd forever (^C to interrupt). Useful for example if you use a remote script invoking "sz" and you don't want to be typing "rz" each time... Remember however that several files can be transferred by a single sz/rz pair so this is not usually necessary to use repeat. rz Receive files from the remote machine. runs rz and plugs the process on the ssh connection. running sz on the REMOTE machine is required : 1) run `sz <remote_file> ...' from the remote machine shell 2) press the escape sequence (C-space) to enter file transfer mode 3) run the `rz' builtin suspend suspend zssh (back to the local machine shell) sz <file> ... Send files to the remote machine. runs sz and plugs the process on the ssh connection. There is no need to manually run rz on the remote side. version print version information builtins rz , sz , hook and exit return to shell mode after completion. OPTIONS
-f --force Do not ask user any question -h --help show basic help -s cmd --shell cmd run cmd as remote shell instead of the default "ssh -e none" (zssh) or "telnet -8 -E" (ztelnet) ex: zssh -s "rsh -x" -V --version show version -z ^X --zssh-escape ^X set escape sequence to ^X -- may be used to separate zssh options from ssh ones Other arguments are passed verbatim to ssh/telnet/whatever. ENVIRONMENT
ZSSHESCAPE Setting the ZSSHESCAPE environment variable allows to override the default escape sequence. ZSSHESCAPE should contain only two characters of the form `^X', meaning that ^X is to be the new escape sequence. REQUIREMENTS
the following binaries need to be properly installed for zssh to work : ssh/telnet/... the remote shell to be executed (local machine) sz rz zmodem send and receive programs. Should be both on local and remote machine, and (hopefully) of compatible versions. TIPS
If file transfer is initiated but never completes ( ie a line like : Bytes Sent: 38144/4610624 BPS:3424 ETA 22:15 or Bytes Sent: 0/ 513 BPS:0 ETA 00:00 Retry 0: Got ZCAN can be seen, but transfer never completes ) Chances are the pty/tty on one of the systems are not 8-bit clean. (Linux is 8-bit clean, NetBSD is not). Using the -e (escape) option of rz should solve this problem. Transfers can be interrupted with ^C (somewhat experimental =) If you get stuck in rz/sz (for example you've just ran rz, but you then decided not to transmit anything), hit a dozen ^X (Ctrl-X, not the zssh escape!) to stop it Use `sz -y <files>' to overwrite files on the other side BUGS
/ LIMITATIONS You may sometimes have to hit return 2 or 3 times after file transfer completion in order get back to the shell. Some digits are usually displayed; don't worry it won't harm (you or your term) ... the tty may (sometimes) be somewhat upset after an interrupted transfer ( using ^C ). typing `reset' in this case should help. no pipe, redirection (and other stuff) support in shell ... but after all there are already wonderful shells around =) CREDITS
ttssh's author - Robert O'Callahan - for the original idea The sourceforge team. AUTHOR
Matthieu Lucotte <gounter@users.sourceforge.net> zssh homepage: http://zssh.sourceforge.net SEE ALSO
ssh(1), telnet(1), scp(1), sz(1), rz(1), readline(3), ZSSH
June 26, 2000 ZSSH(1)
All times are GMT -4. The time now is 12:43 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy