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
passwd(4)							   File Formats 							 passwd(4)

NAME
passwd - password file SYNOPSIS
/etc/passwd DESCRIPTION
The file /etc/passwd is a local source of information about users' accounts. The password file can be used in conjunction with other naming sources, such as the NIS maps passwd.byname and passwd.bygid, data from the NIS+ passwd table, or password data stored on an LDAP server. Programs use the getpwnam(3C) routines to access this information. Each passwd entry is a single line of the form: username:password:uid: gid:gcos-field:home-dir: login-shell where username is the user's login name. The login (login) and role (role) fields accept a string of no more than eight bytes consisting of characters from the set of alphabetic characters, numeric characters, period (.), underscore (_), and hyphen (-). The first character should be alphabetic and the field should contain at least one lower case alphabetic character. A warning message is displayed if these restrictions are not met. The login and role fields must contain at least one character and must not contain a colon (:) or a newline ( ). password is an empty field. The encrypted password for the user is in the corresponding entry in the /etc/shadow file. pwconv(1M) relies on a special value of 'x' in the password field of /etc/passwd. If this value of 'x' exists in the password field of /etc/passwd, this indicates that the password for the user is already in /etc/shadow and should not be modified. uid is the user's unique numerical ID for the system. gid is the unique numerical ID of the group that the user belongs to. gcos-field is the user's real name, along with information to pass along in a mail-message heading. (It is called the gcos-field for historical reasons.) An ``&'' (ampersand) in this field stands for the login name (in cases where the login name appears in a user's real name). home-dir is the pathname to the directory in which the user is initially positioned upon logging in. login-shell is the user's initial shell program. If this field is empty, the default shell is /usr/bin/sh. The maximum value of the uid and gid fields is 2147483647. To maximize interoperability and compatibility, administrators are recommended to assign users a range of UIDs and GIDs below 60000 where possible. (UIDs from 0-99 inclusive are reserved by the operating system vendor for use in future applications. Their use by end system users or vendors of layered products is not supported and may cause security related issues with future applications.) The password file is an ASCII file that resides in the /etc directory. Because the encrypted passwords on a secure system are always kept in the shadow file, /etc/passwd has general read permission on all systems and can be used by routines that map between numerical user IDs and user names. Blank lines are treated as malformed entries in the passwd file and cause consumers of the file , such as getpwnam(3C), to fail. The password file can contain entries beginning with a `+' (plus sign) or '-' (minus sign) to selectively incorporate entries from another naming service source, such as NIS, NIS+, or LDAP. A line beginning with a '+' means to incorporate entries from the naming service source. There are three styles of the '+' entries in this file. A single + means to insert all the entries from the alternate naming service source at that point, while a +name means to insert the specific entry, if one exists, from the naming service source. A +@netgroup means to insert the entries for all members of the network group netgroup from the alternate naming service. If a +name entry has a non-null password, gcos, home-dir, or login-shell field, the value of that field overrides what is contained in the alternate naming service. The uid and gid fields cannot be overridden. A line beginning with a `-' means to disallow entries from the alternate naming service. There are two styles of `-` entries in this file. -name means to disallow any subsequent entries (if any) for name (in this file or in a naming service), and -@netgroup means to disallow any subsequent entries for all members of the network group netgroup. This is also supported by specifying ``passwd : compat'' in nsswitch.conf(4). The "compat" source might not be supported in future releases. The preferred sources are files followed by the identifier of a name service, such as nis or ldap. This has the effect of incor- porating the entire contents of the naming service's passwd database or password-related information after the passwd file. Note that in compat mode, for every /etc/passwd entry, there must be a corresponding entry in the /etc/shadow file. Appropriate precautions must be taken to lock the /etc/passwd file against simultaneous changes if it is to be edited with a text editor; vipw(1B) does the necessary locking. EXAMPLES
Example 1 Sample passwd File The following is a sample passwd file: root:x:0:1:Super-User:/:/sbin/sh fred:6k/7KCFRPNVXg:508:10:& Fredericks:/usr2/fred:/bin/csh and the sample password entry from nsswitch.conf: passwd: files ldap In this example, there are specific entries for users root and fred to assure that they can login even when the system is running single- user. In addition, anyone whose password information is stored on an LDAP server will be able to login with their usual password, shell, and home directory. If the password file is: root:x:0:1:Super-User:/:/sbin/sh fred:6k/7KCFRPNVXg:508:10:& Fredericks:/usr2/fred:/bin/csh + and the password entry in nsswitch.conf is: passwd: compat then all the entries listed in the NIS passwd.byuid and passwd.byname maps will be effectively incorporated after the entries for root and fred. If the password entry in nsswitch.conf is: passwd_compat: ldap passwd: compat then all password-related entries stored on the LDAP server will be incorporated after the entries for root and fred. The following is a sample passwd file when shadow does not exist: root:q.mJzTnu8icf.:0:1:Super-User:/:/sbin/sh fred:6k/7KCFRPNVXg:508:10:& Fredericks:/usr2/fred:/bin/csh +john: +@documentation:no-login: +::::Guest The following is a sample passwd file when shadow does exist: root:##root:0:1:Super-User:/:/sbin/sh fred:##fred:508:10:& Fredericks:/usr2/fred:/bin/csh +john: +@documentation:no-login: +::::Guest In this example, there are specific entries for users root and fred, to assure that they can log in even when the system is running stand- alone. The user john will have his password entry in the naming service source incorporated without change, anyone in the netgroup documen- tation will have their password field disabled, and anyone else will be able to log in with their usual password, shell, and home direc- tory, but with a gcos field of Guest FILES
/etc/nsswitch.conf /etc/passwd /etc/shadow SEE ALSO
chgrp(1), chown(1), finger(1), groups(1), login(1), newgrp(1), nispasswd(1), passwd(1), sh(1), sort(1), domainname(1M), getent(1M), in.ftpd(1M), passmgmt(1M), pwck(1M), pwconv(1M), su(1M), useradd(1M), userdel(1M), usermod(1M), a64l(3C), crypt(3C), getpw(3C), getpw- nam(3C), getspnam(3C), putpwent(3C), group(4), hosts.equiv(4), nsswitch.conf(4), shadow(4), environ(5), unistd.h(3HEAD) System Administration Guide: Basic Administration SunOS 5.11 28 Jul 2004 passwd(4)
All times are GMT -4. The time now is 05:08 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy