06-15-2009
Hi Guys,
I did something good today:
My situation:
-----------
I had 2 servers say server A and server B. Server A had got millions of files and directories. I had to keep the same ownership and group ownership in server B as in Server A. For this I did below:
1. Get to know the file ownerships in server A and put it in a file
find . -type f | sed "s#^.#$(pwd)#" | xargs ls -l | tr -s " " " " | cut -f3,4,9 -d\ > perm.conf
find . -type d | sed "s#^.#$(pwd)#" | xargs ls -ld | tr -s " " " " | cut -f3,4,9 -d\ >> perm.conf
2. copy the perm.conf on the server B under the same hierachy as in server A.
3. Then I wrote a script:
#!/bin/sh
k=`wc -l perm.conf | cut -f1 -d\ `
i=1
RECORD=""
OWNER=""
GROUP=""
FILE=""
while [ $k -ne $i ]
do
RECORD=`head -$i perm.conf | tail -1`
OWNER=`echo $RECORD | cut -f1 -d\ `
GROUP=`echo $RECORD | cut -f2 -d\ `
FILE=`echo $RECORD | cut -f3 -d\ `
chown $OWNER:$GROUP $FILE 2>> logfile
i=`expr $i + 1`
done
and I was done...
Hope this help someone...
Thanks and regards,
Pravin Goyal
10 More Discussions You Might Find Interesting
1. UNIX for Advanced & Expert Users
How can i list every single file on a sun solaris server running 2.8 starting from '/' with the full path included in it?
example.
/
...
...
...
/etc/inetd.conf
/etc/passwd
/etc/shadow
...
...
...
/var/adm/messages
/var/adm/messages.0
/var/adm/messages.1
...
...
...... (4 Replies)
Discussion started by: Sowser
4 Replies
2. Shell Programming and Scripting
Hi all,
How to save file full name to a file. I tried the following but don't know to include path name.
$ ls -l | awk '{print $9}' > outputfile.dat
$ cat outputfile.dat
fifth.txt
first.txt
fourth.txt
second.txt
third.txt
My wanted result is ie:
... (3 Replies)
Discussion started by: mr_bold
3 Replies
3. Red Hat
How can i perform a ls or other command to list the full paths of files from a ls?
Looked through the man page for ls, no luck
$ cd /tmp/
$ ls -l
total 6
drwx------ 2 root root 4096 Nov 7 2008 keyring-7b5rMv
drwx------ 2 bcr bcr 4096 Dec 7 2007 keyring-cGhir8
$
I'd be looking for... (1 Reply)
Discussion started by: brendan76
1 Replies
4. Shell Programming and Scripting
hello every one,
i'm a novice in the field of Linux, so please help me out with this problem.
a text file with the following syntax is given:
file1
file2
file3
file4
file5
a script is to be written to list all d file names and tar the files with the filename... (3 Replies)
Discussion started by: Amruthesh C
3 Replies
5. Windows & DOS: Issues & Discussions
Hi,
(Apologies, I'm sure I'm not the first person to raise this question but so far in my searches haven't found a good answer).
I would like to output a listing per line of filename (including full path) and 'last updated' timestamp. e.g:
Z:\dir1\file1.txt 01/02/2010 10:43... (5 Replies)
Discussion started by: GM_AIX
5 Replies
6. Shell Programming and Scripting
/Path/snowbird9/nrfCompMgrRave1230100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird6/nrfCompMgrRave1220100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.
/Path/snowbird14/nrfCompMgrRave920100920.log.gz:09/20/2010 06:14:51 ERROR Error Message.... (0 Replies)
Discussion started by: Shirisha
0 Replies
7. Shell Programming and Scripting
Hi all,
I want to check the list of all directories and links in a particular directory and here, i have the list of the directories/links which i need to print on screen.
I used the below command to check the dir/links,
cd path1 ; ls -ltd `cat dir_links_list`
But here, i don't want to... (3 Replies)
Discussion started by: raghu.iv85
3 Replies
8. Shell Programming and Scripting
How to list all Subdirectories and files with its full path in a parent directory? (1 Reply)
Discussion started by: johnveslin
1 Replies
9. Shell Programming and Scripting
Hi,
I need to do find and replace, but the pattern is not full known.
for example,
my file has /proj/app-d1/sun or /data/site-d1/conf
here app-d1 and site-d1 is not constant. It may be different in different files. common part is /proj/xx/sun and /data/xxx/conf
i want to find where ever... (6 Replies)
Discussion started by: rbalaj16
6 Replies
10. UNIX for Beginners Questions & Answers
my requirement is 30 days old files along with size and pull path of the file (file should be listed in descending by size).
output:
12345 /app/testing/file1
12341 /app/testing/file2 (5 Replies)
Discussion started by: Rajesh123
5 Replies
LEARN ABOUT OPENDARWIN
afp_signature.conf
AFP_SIGNATURE.CONF(5) Netatalk 2.2 AFP_SIGNATURE.CONF(5)
NAME
afp_signature.conf - Configuration file used by afpd(8) to specify server signature
DESCRIPTION
/etc/netatalk/afp_signature.conf is the configuration file used by afpd to specify server signature automagically. The configuration lines
are composed like:
"server name" hexa-string
The first field is server name. Server names must be quoted if they contain spaces. The second field is the hexadecimal string of 32
characters for 16-bytes server signature.
The leading spaces and tabs are ignored. Blank lines are ignored. The lines prefixed with # are ignored. The illegal lines are ignored.
Note
Server Signature is unique 16-bytes identifier used to prevent logging on to the same server twice.
Netatalk 2.0 and earlier generated server signature by using gethostid(). There was a problem that another servers have the same
signature because the hostid is not unique enough.
Current netatalk generates the signature from random numbers and saves it into afp_signature.conf. When starting next time, it is read
from this file.
This file should not be thoughtlessly edited and be copied onto another server. If it wants to set the signature intentionally, use the
option "-signature user:xxxx" in afpd.conf. In this case, afp_signature.conf is not used.
EXAMPLES
Example. afp_signature.conf three servers on one netatalk
# This is a comment.
"Guest Server" 251D25569CB29AFDF296C6B5B3A385B7
"User Server" 26B5D785046C019F55718F76B1C13BFB
special 74A0BB94EC8C13988B2E75042347E528
SEE ALSO
afpd(8), afpd.conf(5), asip-status.pl(1)
Netatalk 2.2 08 Mar 2011 AFP_SIGNATURE.CONF(5)