Sponsored Content
Full Discussion: Any Ideas?
Top Forums Shell Programming and Scripting Any Ideas? Post 22747 by Docboyeee on Monday 10th of June 2002 11:59:20 AM
Old 06-10-2002
Any Ideas?

I have several staging directories on my UNIX server.

/usr2/data1
/usr2/data2
/usr2/data3
/usr2/data4
/usr2/data5
/usr2/data6

In these directories a file is transferred from different PC's connected to the network via TCP/IP. The File name is constant for all directories.

Transfers from the PC to the UNIX server could possibly take place several times during the day. Meaning - the information from PC1 that is sent to the UNIX server and placed in /usr2/data1 could possibly be sent several times during the course of the day or even several days before it is processed. I would like to write a script that would check each one of these directories and see if there is a file in there. The filename will be constant. My delima is this:

1) I don't want to overwrite a file that is currently sitting in that directory. So.. I would need to move the file out of the staging directory and place it over into a different directory. But let's suppose that when my script looks in this directory and sees a file in there... how am I to know whether the file has been completely transferred from the PC to the UNIX server? I don't want to try and move the file right in the middle of the ftp process between the PC and the UNIX server.

2) I want to rename the file and place it into a process directory for processing. However, I don't want to name the file the same name as a file that already exists in the directory.

3) I eventually want to cat all these files together for processing and move them out of my process directory into a hold directory in case something happened during the processing.


Anyone got any ideas ?
 

8 More Discussions You Might Find Interesting

1. Cybersecurity

Any Ideas !!!!!!!!!!

Hi, I installed sybase server on a LINUX server. I assigen port 2025 whilst installation for sybase , later i uninstalled sybase and when i try to reinstall sybase and use port 2025 it throw up error saying that it is already in use, use other port number. How can I re-use the same port number... (2 Replies)
Discussion started by: suda
2 Replies

2. Shell Programming and Scripting

any ideas?

i need to compare to dates/times given in the format MMDDhhmmYY. That is month, day, hour, minute, year. It is a 24 hour clock. I need to compare two dates to check that they are, say, less than 900 seconds apart. I have got to a point where it checks the time, turns the values into seconds and... (5 Replies)
Discussion started by: fwabbly
5 Replies

3. Shell Programming and Scripting

Scripting ideas?

Hi All, How can I script the following logic? Step 1: Check if the file xyz.txt exists under direcotry test and if the size of the file xyz.txt is greater than 32MB. Step 2: If the above conditions are true(file exists and size >32 MB), then step 3, otherwise step 4 (file does not exist or... (2 Replies)
Discussion started by: Sueyoung88
2 Replies

4. Solaris

Need ideas what is wrong with v440

Hello everyone, I'm here today looking for help... I have a SunFire v440 running Solaris 9 at work that manages the SCSI tape drives(LTO3) in our L700 tape library (runs SAMFS). I went into work today and found the machine was ping-able but I could not connect to it via SSH and could not... (7 Replies)
Discussion started by: mainegeek
7 Replies

5. UNIX for Advanced & Expert Users

Sendmail - Any Ideas?

I have solaris 9 and am using sendmail to pickup requests and forward them to a bulk mail server on a different port. Now for the fun...In sendmail, I need to find a way to place a default address in the Mail From: and Rcpt To: or remove them as required - These will be picked up by the bulk mail... (3 Replies)
Discussion started by: mikey2003ma
3 Replies

6. UNIX and Linux Applications

Need ideas for graduation project based on unix or linux Need ideas for graduation project based on

Dear all, i am in last year of electronics department in engineering faculty i need suggestions for a graduation project based on unix or free bsd or linux and electronics "embedded linux " i think about embedded unix for example or device drivers please i need helps (1 Reply)
Discussion started by: MOHA-1
1 Replies

7. Shell Programming and Scripting

Ideas for while loop

idealy, i'd like to do something like this: while read line do echo $line done < $(egrep error /var/log/syslog) but when i do, i get an unexpected response. i.e. cat test: #!/bin/sh while read line do echo $line done < $(egrep error /var/log/syslog) (12 Replies)
Discussion started by: SkySmart
12 Replies

8. Shell Programming and Scripting

Help me get some ideas

Hello, I have been given a scripting project, but have not learned any scripting. I need to get some ideas on how to start. Attached is part of the project: I have no idea how to parse the arguments. What I had in mind was to get the arguments ($1, $2, ... ) and have if statements for different... (1 Reply)
Discussion started by: facepalm
1 Replies
nfs(4)							     Kernel Interfaces Manual							    nfs(4)

NAME
nfs, nfs_intro - Network File System (NFS) information DESCRIPTION
NFS is a facility for sharing files in a heterogeneous environment of processors, operating systems, and networks. Sharing is accomplished by mounting a remote file system or directory on a local system and then reading or writing the files as though they were local. Sharing file systems has the following advantages: Removes the need to copy files across the network from one system to another Provides easier access to remote files Reduces the risk of having out-of-date copies of the same file on different systems The NFS Environment NFS is based on the client-server model, in which client systems request resources from other systems called servers. A server is any host system or process that provides a network service. A client is any host system or process that uses services from a server. A single host, or server, can provide more than one service. Servers are passive; they do not call clients, they wait for clients to call them. A one-to-one correspondence between servers, clients, and systems does not always exist. A system that acts as a server can also act as a client. A server that exports file systems and directories can also mount remote file systems and directories exported by other systems, thus becoming a client. To export a file system or directory is to make it available for NFS clients to mount remotely on their local sys- tems. The /etc/exports file defines the NFS file systems and directories that can be exported. The following table summarizes the distinctions between client and server systems for NFS mounts. -------------------------------------------------------------- Client Server -------------------------------------------------------------- Requests a remote mount Responds to the mount request Reads the /etc/fstab file Reads the /etc/exports file Checks if the server is known Checks if the client is known -------------------------------------------------------------- The client always initiates the remote mount. The server completes the bindings, subject to access-control rules specific to NFS. Because most network administration problems occur at bind time, you should know how a client binds to a server and what access control policy each server uses. For more information on access control, see the NFS Service section and the Network Administration manual. You mount a remote file system by using either the mount command or an automatic mounting daemon, such as Automount or AutoFS. In addi- tion, you can use the WebNFS protocol, which bypasses mount and gives direct access to the WebNFS served file system. An NFS client selects a specific server from which to mount a file system or directory. A client can mount file systems and directories from several different servers. Network Transport Protocols NFS can use either the Transmission Control Protocol (TCP) or User Datagram Protocol (UDP) protocol. The TCP protocol is best for con- gested wide area networks because of its superior retransmit features and congestion control. The UDP protocol is best in networks where congestion and lost messages are not a problem because its lower overhead might yield higher throughput. The client selects the transport protocol in the mount command. The NFS Service Once a remote file system or directory is mounted, it can be used as a local file system by client programs. Typically, a client mounts one or more remote file systems and directories at start up time, if lines similar to the following are in the /etc/fstab file. The mount program reads these lines when the system starts up: titan:/usr2 /usr2 nfs rw,bg 0 0 venus:/usr/man /usr/man nfs rw,bg 0 0 The first line in the example shows that the /usr2 directory at system titan is mounted at local mount point /usr2 when you boot the local system. The rest of this line describes the mount. See fstab(4) for a description of the file format. NFS servers control access to their resources by limiting named file systems and directories to a specific set of clients with an entry in the /etc/exports file. The /etc/exports file allows you to limit access to NFS clients but not to individual remote users. By default in Tru64 UNIX, mounts can be limited to client superusers only. The following four programs implement the NFS service: portmap mountd nfsiod nfsd A client's mount request is transmitted to the remote server's mountd daemon after obtaining its address from portmap. A port mapper is a Remote Procedure Call (RPC) daemon that maps RPC program numbers of network services to their UDP or TCP protocol port numbers. The mountd daemon checks the access permission of the client and returns a pointer to the file system or directory. After the mount is completed, access to files and directories at and below that mount point go through the pointer to the server's NFS daemon (nfsd) using remote procedure calls. Some file access requests (write-behind and read-ahead) are handled by the block I/O daemon (nfsiod) on the client. PC-NFS The PC-NFS facility provides the benefits of NFS to personal computers on your network. PC-NFS enables personal computers to share resources and exchange files, and like NFS, is based on the client-server model. The client software runs on the personal computer; the server software resides in the /usr/sbin directory. For information on the PC-NFS client, see your PC-NFS client documentation. For instructions on making the PC-NFS server available to clients, refer to Network Administration. The NFS Locking Service The NFS Locking Service (rpc.lockd) allows you to create advisory locks on files and file regions on local and remotely mounted file sys- tems. Advisory locks are not enforced. To make use of the NFS Locking Service, a programmer needs to understand how to use the fcntl system call or the lockf subroutine. See fcntl(2) and lockf(3) for programming information. File locking is a way to manage access to shared files. A process takes the following steps when locking a file or region of a file: Determines if the file or region within the file is locked Applies a lock if the file or region is not locked Makes the changes to the file or region Unlocks the file or region The NFS Locking Service coordinates the dispersal of locks to remote file systems. It communicates with the kernel and status monitor (rpc.statd) of the local system, as well as with the other lock daemons on the network. The NFS Locking Service uses a stateless approach to failure recovery. The fundamental element of this approach is that the status monitor detects both client and server recoveries. This approach is passive. When the client status monitor detects that a failed server has reinitialized (recovered), it notifies the local locking daemon of the failure. The lock daemon then activates the appropriate recovery mechanism. If the NFS server fails and the NFS Locking Service is enabled, all the locks managed by the server's local processes are lost. However, when the server recovers, the lock manager daemons on the client systems send reclaim requests for the NFS locks. The server lock manager reestablishes the previously acquired locks associated with the reclaim requests, provided the requests are received within the grace period built into the NFS Locking Service. During the grace period, the server lock manager honors only reclaim requests. Once the grace period expires, reclaim requests are no longer valid, and the server lock manager accepts only new requests. At this time, the server lock manager cannot reestablish old locks. A user process whose lock could not be reclaimed is sent a SIGLOST signal. The client lock manager can create new locks by using the interface primitives in the fcntl system call or the lockf subroutine. If a client fails while it is using the NFS Locking Service, then when the client recovers, the status monitor daemon notifies the appro- priate servers. The server lock manager then releases the locks. The client applications can then issue new lock requests as part of their recovery procedure. Automatic Mounting Daemons NFS clients can optionally run an automatic mounting daemon, such as Automount or AutoFS. These daemons are client interfaces that perform remote mounts automatically, and only when they are needed. If you need to access a remotely mounted file or directory, the selected dae- mon mounts it, keeping it mounted as long as you need it. The automount and autofsd daemons are told which remote file systems to mount from a database file called a map. A map lists the remote file systems that the selected daemon monitors, their locations, and any mount options. The maps can be shared through NIS. There are three types of maps: Master - Although not required, the master map helps to organize mounts. If a master map exists, it is read first when the automount or autofsmount commands are invoked, acting as a pointer to other maps. Both commands look for an NIS map called auto.master when invoked. They can also be instructed to use a local master map. Direct - Specifies a key that is the pathname of the mount point, and a location, which is the location of the file system or directory in which it resides, specified in this format: server:pathname. For direct maps, a local mount point is specified as an absolute path- name, such as /doclib. Indirect - Like a direct map, specifies the pathname of the mount point and the location of the file system on which it resides. For indirect maps, a local mount point is specified as a simple pathname, such as docsrc because the whole map is associated with a directory. For more information these daemons, see automount(8), autofsd(8), and autofsmount(8). Or, refer to the Network Administration manual. RELATED INFORMATION
Commands: autofsmount(8), automount(8), nfsstat(8) Daemons: autofsd(8), automount(8), mountd(8), nfsd(8), nfsiod(8), rpc.lockd(8), rpc.statd(8) Files: advfs(4), cdfs(4), fstab(4) Technical Overview, Network Administration delim off nfs(4)
All times are GMT -4. The time now is 02:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy