LinuxQuestions.org
Help answer threads with 0 replies.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-30-2016, 04:13 PM   #1
paulwintech
LQ Newbie
 
Registered: May 2012
Posts: 6

Rep: Reputation: Disabled
How to check a folder user/group details and replicate the same in for other servers


Hi,

In my server i have Oramaster and this will be oracle primary folder which has app, installer etc., and the user/group will be set so that DB team can access this folder... But requirement for projects get chances like the oracle filesystem will be increase apart from Oramaster.

For example

Oramaster -- Primary
oraslave1
oraslave2
oraslave3

So im creating a script as below to check the Oramaster and replicate(chown) the user/group for oraslave*. First of all i need to check whether oraslave is present if so Oramaster permission(user/group) is replicated and im not sure how to create a IF loop.

ls -al /Oramaster | awk '{print $3,$4}'| tail -n 1 | xargs chown $1.$2 /oraslave{1,2,3}

But Unfortunately this is not working, Please advice how my requirement can be met please?

Last edited by paulwintech; 01-30-2016 at 04:15 PM.
 
Old 01-30-2016, 04:28 PM   #2
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Quote:
Originally Posted by paulwintech View Post
First of all i need to check whether oraslave is present if so Oramaster permission(user/group) is replicated and im not sure how to create a IF loop.
Code:
if [ -d /Oramaster ]; then echo 'Exists' ; else echo "Do Stuff"; fi
Welcome to LQ!
 
Old 01-31-2016, 01:11 PM   #3
paulwintech
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Hi, Thanks for the info

Is that possible also to check the user/group of Oramaster folder and replicate the same permission to other folders please?

eg:-

Ormaster is owned by Orauser:OraGroup (So the permission should be root:root, if so the permission should not be replicated)

and same as to replicate to

oraslave{1,2,3}

oraslave1 Orauser:OraGroup
oraslave2 Orauser:OraGroup

Sorry i missed in my previous thread --> Script should check whether oraslave 1 etc is there if so then Ormaster permission should be replicated... Because depends on server needs oraslave is created i.e in some server oraslave1 will be there in some other server oraslave1, oraslave2 & orslave3 will be there.
 
Old 01-31-2016, 04:28 PM   #4
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Yes, it should be possible.
 
Old 02-03-2016, 10:17 AM   #5
paulwintech
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
ok, Could you please guide me how this can be done
 
Old 02-03-2016, 11:08 AM   #6
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Paul:

I'll do my level best.
So...
You want to "test" for /Oramaster/oraslave[123] and replicate that structure to another host(s)?

"rsync -p" will preserver permissions from the source to the target.
What if /Oramaster/oraslave[123] exists on the target?
What if one of them is missing on the target?

Thanks.

John
 
Old 02-04-2016, 10:21 AM   #7
paulwintech
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
HI,

Please find the below update

You want to "test" for /Oramaster/oraslave[123] and replicate that structure to another host(s)?
--- No we have a tool which changes the permission to /Oramaster and script had to check whether /Ormaster is present if YES then the permission is replicated across /Oraslave{etc}. IF NO nothing has to be done.

/Oramaster & /Oraslave are present in same server(i.e) Root directory


"rsync -p" will preserver permissions from the source to the target.
What if /Oramaster/oraslave[123] exists on the target?

--- /Oramaster is separate folder & /Oraslave will be separate folder.

What if one of them is missing on the target?

--- If missing message should be displayed and no action should be taken
 
Old 02-04-2016, 10:38 AM   #8
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Paul:

/Oramaster
/Oraslave[123]

Correct?
Same host...
I took "replicate" to mean another host...
This may very well be "true" for one single host, but the post subject says differently.
But my mind is busy this morning kicking script kiddies in the @ss, so
I have to grok this around my head for a few.
Others may have something to add while I chew on it...

I'm confused by
Quote:
Originally Posted by paulwintech View Post
Ormaster is owned by Orauser:OraGroup (So the permission should be root:root, if so the permission should not be replicated)
It's either Orauser:OraGroup
or
root:root

Last edited by Habitual; 02-04-2016 at 10:46 AM.
 
Old 02-08-2016, 10:00 AM   #9
paulwintech
LQ Newbie
 
Registered: May 2012
Posts: 6

Original Poster
Rep: Reputation: Disabled
Only Master folder (OraMaster) as the default permission as Orauser:OraGroup.. Rest of the slave folders (Oraslave) will be in root premission which we need to change that to Orauser:OraGroup

Sorry for my BAD English
 
Old 02-08-2016, 10:10 AM   #10
Habitual
LQ 5k Club
 
Registered: Jan 2011
Location: Nowhere near you, thank God.
Distribution: OSX Sierra
Posts: 8,598
Blog Entries: 15

Rep: Reputation: Disabled
Paul:
Your English is fine.
Your last statement conflicts with
Quote:
Originally Posted by paulwintech View Post
Is that possible also to check the user/group of Oramaster folder and replicate the same permission to other folders please?
Please restate the requirement, Thank you.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
User is a Part of a Group But Group Details Do Not Show the User devUnix Linux - Server 6 08-08-2013 08:02 AM
How to replicate a folder and its contents instantly across N servers? sneakyimp Linux - Newbie 9 01-18-2013 04:51 PM
how to give access to particulat user in ftp user group to particular folder marora Linux - General 2 06-16-2011 03:03 AM
User or Group Creation Details valen_tino Red Hat 1 06-12-2009 11:23 AM
virtualbox group/user folder Fred Caro Linux - Software 7 07-12-2008 09:11 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 12:17 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration