Kermit and


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Kermit and
# 1  
Old 09-18-2008
Kermit and

I have a small problem with kermit and after some days searching I don't find the solution. I have a FTP server with a local directory (ldirectory). If files appear in this directory they have to be send to another server, and deleted afterwards. The script don't take files with *.tmp extension. During the transfer, the file is named .tmp; so the other side knows that the transfer is still going. So I execute this script each 5 minutes to look for files.

Code:
#!/usr/bin/kermit +

# Set transfer parameters
.host = 10.2.30.180             ;hostname
.ruser = loginuser                ;username
.rpsswd = loginpass              ;password
.rdirectory = in                ;remote directory
.ldirectory = /home/user/out         ;local directory
.logfile := transfer.log                ;logfile

# Set logging parameters
set transaction-log ftp
set ftp display none
set ftp verbose-mode on
log transactions \m(logfile) append

# Set transaction parameters
set exit warning off
set ftp collision backup
set ftp unique-server-names on
set ftp type binary

# Do the transaction
ftp open \m(host) /user:\m(ruser) /password:\m(rpsswd)
if fail exit 1 "Connection failed"
if not \v(ftp_loggedin) exit 1 "Login failed - \m(ruser)"
lcd \m(ldirectory)
if fail exit 1 "LCD failed - \m(ldirectory)"
cd \m(rdirectory)
if fail exit 1 "RCD failed - \m(rdirectory)"
ftp mput /delete /binary /except:*.tmp /as-name:\v(filename).tmp /server-rename:\v(filename) *
if fail exit 1 "Transactions failed"

# Close the transaction
ftp bye
close transaction-log
exit 0

My problem is , that if there are NO files, the script generates an error:

Code:
?No files match MPUT list
Command stack:
  1. File  : /home/user/transferftp.sh (line 31)
  0. Prompt: (top level)
Transactions failed
You have transferred 0 bytes in 0 files.

In fact, I need a system that before the mput he have to test if there are files in the local directory, and only if there are files he has to execute the mput command. But I don't find it . Smilie

I tried it with "if exists *"; but this don't seems to work because this way he always thinks there are files present.

Does someone have tips?
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Ubuntu

establishing connection with e-kermit running on LINUX from my operating system

we designed a primitive operating system for learning basics fundamentals and we created process switching, interrupt/polled IO for device drivers like UART and printers. We accomplish this by using our own tools called SPEDE (for downloading compiled elf image from host ubuntu system that have... (0 Replies)
Discussion started by: bicepjai
0 Replies

2. Solaris

C-Kermit and SunOS 5.10

Has anyone managed to install C-Kermit successfully on SunOS 5.10? SunOS 5.10 Generic_141444-09 sun4v sparc SUNW,T5240 I installed with "make solaris9g64", the only make that worked. If I'm not mistaken, isn't there a test to see if ssl is available? Something like C-Kermit>define... (0 Replies)
Discussion started by: MichaelInDC
0 Replies

3. Shell Programming and Scripting

How to send AT commands after getting into Kermit window?

We're using Kermit 8.0.209 in Linux environment. We're trying to invoke kermit from an application, send some AT commands and receive the responses from the End terminals like mobiles/modems. We access these deivces through serial ports. For eg., to send a file we use command-line options like... (4 Replies)
Discussion started by: pratiul
4 Replies

4. UNIX for Dummies Questions & Answers

c-kermit anyone?

Firstly, I would like to apologise at what I have no doubt is a very easy query. However, I have been roaming around the c-Kermit homepage for sometime now and I have yet to find an answer to my problem. I am trying to write short script that will automatically retrieve a file. To do this I am... (0 Replies)
Discussion started by: AvalonHaze
0 Replies

5. Shell Programming and Scripting

Kermit script

Hi, How can I read the second line in kermit? fread reads line in kermit. Thank you (1 Reply)
Discussion started by: kayarsenal
1 Replies

6. IP Networking

Kermit- dialup and network connection

hi all, Using kermit, i made serial dialup connetion between two PCs through telephone line and transfered files trough this line. The code appears as like this, set modem type generic #Setting the modem type. set modem data-compression on #Data compression on to speed up transfer.... (0 Replies)
Discussion started by: pcsaji
0 Replies

7. UNIX for Dummies Questions & Answers

About the kermit

I have a kermit file for HP unix , it work fine to download files , if I want to use it at AIX server , could I just copy it to AIX server ? if not , could suggest where can download it for AIX server ? and is it free ? am wonder whether kermit is a free package , I hv google it , but not find ,... (6 Replies)
Discussion started by: ust
6 Replies

8. Shell Programming and Scripting

C-Kermit scripting

Hi , I am using C-Kermit for automating FTP of files from my local Solaris Box to remote Solaris Box.I am able to send the files successfully. And i can also log the whole transaction into a log file.But i want a list of files ( redirected to some other file ) that went successfully and list of... (0 Replies)
Discussion started by: sveera
0 Replies
Login or Register to Ask a Question