Sponsored Content
Operating Systems Linux SuSE When a FTP download is completed Post 75266 by Perderabo on Thursday 16th of June 2005 12:00:44 PM
Old 06-16-2005
Quote:
Originally Posted by Javi
The command 'lsof' doesn't show the file that the 'vsftpd' process is writting. I get the same problem with 'fuser'.

I have made a C program that lock in exclusive mode the file. I thought that If I am able to lock the file then the file is not open by another process. But It doesn't work, the program is able to lock the file although the file is downloading.

The real problem appear to be that, nowhere in the Linux system reside information about the files than the vsftpd daemon is working with ...
Re paragraph 1: I find it very hard to believe that lsof can't do this. Your lsof could be broken, more more likely you are doing something wrong. Since you haven't mentioned stuff like precisely what command you used or precisely what result you got there's no way to tell. Could you take a bug report like: "'lsof' doesn't show the file" and do anything with it?

Re paragraph 2: "exclusive locks" are the only kind that exist. If you want a mandatory lock, read mandatory.txt. But this won't help much. If you do it correctly, you will succeed, and vxftpd will experience failed writes. It will probably detect this and inform the ftp client of the error.

Re paragraph 3: I wonder how the data gets to the file?

I looked at the source code for vsftpd. I see it has a logging option. Turn that on and parse the log to see if the file is finished.
 

10 More Discussions You Might Find Interesting

1. HP-UX

Ftp Download Problem

FROM WINDOWS , WHILE GETTING DATA FROM HP-UNIX SERVER USING FTP, I AM ABLE TO GET DATA ONLY LESS THAN 4GB FILE, PLZ HELP ME HOW TO GET MORE MORE THAN 4GB FILE. (4 Replies)
Discussion started by: niranjan
4 Replies

2. HP-UX

ftp download problem

from windows ftp tool even you are not root user you can delete root files (8 Replies)
Discussion started by: mkhsy
8 Replies

3. Shell Programming and Scripting

Cron Jobs for FTP download

Dear All, Please to be inform you,I have posted one thread on this forum last 5 days back. I was not getting suggestions for my thread. So i am creating a new thread with detailed of my R&D. I am new in Shell Scripts, Perl and Cron Jobs. I have one requirement in Cron jobs for FTP Download.... (5 Replies)
Discussion started by: moorthygs
5 Replies

4. UNIX for Dummies Questions & Answers

FTP Download username and password

I am trying to download from ftp server (rsync and postfix). But every time I connect to the ftp server, it prompts for USER and PASS but I don't know which username and and password to use. And I am using command based UNIX OS. (2 Replies)
Discussion started by: kumarrana
2 Replies

5. Shell Programming and Scripting

download specified file from ftp server

Hi all, I'm having problems downloading files from ftp server. I have to download only those files that name starts with YYYYMMDD.But file comes like the format "20080624221035.TXT".Also how i can get list of all file names with in specified folder. Here i paste my code ftp -vn... (1 Reply)
Discussion started by: vaskarbasak
1 Replies

6. UNIX for Dummies Questions & Answers

cURL Active FTP Download

Hello, I know this is probably a very silly question for most but how to do I force curl to do active FTP downloads? Thank you Dallas (2 Replies)
Discussion started by: Dallasbr
2 Replies

7. Windows & DOS: Issues & Discussions

Download patches using FTP client

Hi all, I want to download patches using any FTP client by connecting to updates.oracle.com site on windows platform.Please advice me on this. I am using windows xp operating system Thanks in advance (0 Replies)
Discussion started by: William1482
0 Replies

8. Shell Programming and Scripting

Download data from ftp.

Dear all, I am beginner to shell scripting. I have to download more than 1k files from ftp site. link is below ftp://ftp.ncbi.nih.gov/genomes/Bacteria/ Earlier i was using wget url, for download but the problem is some times folder names get changed, i don't know how to move in directories... (4 Replies)
Discussion started by: admax
4 Replies

9. Shell Programming and Scripting

Download files every one second using ftp script

Our main Server "Srv1" is used to generate text files based on specified criteria and it is also connected to two clients (pc1 and pc2) which are responsible for getting the files from Srv1 as it follows: 1. pc1 ( which represents my UNIX machine ) uses shell script to copy the files from Srv1 2.... (3 Replies)
Discussion started by: arm
3 Replies

10. Shell Programming and Scripting

FTP File download

Hi, I have few files at FTP location and have written a script to download the same from ftp based on the sysdate - 1, however with the below code I am unable to download the files from FTP. x=`TZ=CST+24 date +%Y%m%d` mget Daily_BIH_$x_NEW.tar.gz can anyone please help me in... (10 Replies)
Discussion started by: rramkrishnas
10 Replies
LOCKF(3)						     Linux Programmer's Manual							  LOCKF(3)

NAME
lockf - apply, test or remove a POSIX lock on an open file SYNOPSIS
#include <unistd.h> int lockf(int fd, int cmd, off_t len); Feature Test Macro Requirements for glibc (see feature_test_macros(7)): lockf(): _BSD_SOURCE || _SVID_SOURCE || _XOPEN_SOURCE >= 500 || _XOPEN_SOURCE && _XOPEN_SOURCE_EXTENDED DESCRIPTION
Apply, test or remove a POSIX lock on a section of an open file. The file is specified by fd, a file descriptor open for writing, the action by cmd, and the section consists of byte positions pos..pos+len-1 if len is positive, and pos-len..pos-1 if len is negative, where pos is the current file position, and if len is zero, the section extends from the current file position to infinity, encompassing the present and future end-of-file positions. In all cases, the section may extend past current end-of-file. On Linux, lockf() is just an interface on top of fcntl(2) locking. Many other systems implement lockf() in this way, but note that POSIX.1-2001 leaves the relationship between lockf() and fcntl(2) locks unspecified. A portable application should probably avoid mixing calls to these interfaces. Valid operations are given below: F_LOCK Set an exclusive lock on the specified section of the file. If (part of) this section is already locked, the call blocks until the previous lock is released. If this section overlaps an earlier locked section, both are merged. File locks are released as soon as the process holding the locks closes some file descriptor for the file. A child process does not inherit these locks. F_TLOCK Same as F_LOCK but the call never blocks and returns an error instead if the file is already locked. F_ULOCK Unlock the indicated section of the file. This may cause a locked section to be split into two locked sections. F_TEST Test the lock: return 0 if the specified section is unlocked or locked by this process; return -1, set errno to EAGAIN (EACCES on some other systems), if another process holds a lock. RETURN VALUE
On success, zero is returned. On error, -1 is returned, and errno is set appropriately. ERRORS
EACCES or EAGAIN The file is locked and F_TLOCK or F_TEST was specified, or the operation is prohibited because the file has been memory-mapped by another process. EBADF fd is not an open file descriptor; or cmd is F_LOCK or F_TLOCK and fd is not a writable file descriptor. EDEADLK The command was F_LOCK and this lock operation would cause a deadlock. EINVAL An invalid operation was specified in fd. ENOLCK Too many segment locks open, lock table is full. CONFORMING TO
SVr4, POSIX.1-2001. SEE ALSO
fcntl(2), flock(2) locks.txt and mandatory-locking.txt in the Linux kernel source directory Documentation/filesystems (on older kernels, these files are directly under the Documentation directory, and mandatory-locking.txt is called mandatory.txt) COLOPHON
This page is part of release 3.44 of the Linux man-pages project. A description of the project, and information about reporting bugs, can be found at http://www.kernel.org/doc/man-pages/. GNU
2012-07-07 LOCKF(3)
All times are GMT -4. The time now is 02:01 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy