- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- split with FS a string (filesystem )
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2012 08:23 AM
01-19-2012 08:23 AM
hello,
i have a filesystem and subdirectories like /mnt/db1/ORASID
i want to set dynamic for the mountpoint and db1 the user "root:sys" and only for dir ORASID the oracle user "oracle:dba":
/mnt user root:sys
/mnt/db1 user root:sys
/mnt/db1/ORASID user oracle:dba
here is my version , i am not happy
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-19-2012 12:56 PM
01-19-2012 12:56 PM
Re: split with FS a string (filesystem)
>i want to set dynamic for the mountpoint and db1 the user "root:sys" and only for dir ORASID the oracle user "oracle:dba":
I'm not sure what you are trying to do?
You can optimize your script with:
typeset -i i=0
>filesystem_split="${fs_split_ifs}""${filesystem[${i}]}"
>filesystem_split="${filesystem_split}""/""${filesystem[${i}]}"
Not sure why you have stuttered quotes. You just need the outer ones:
filesystem_split="${filesystem_split}/${filesystem[${i}]}"
(You also don't need ${} within subscripts, [i] will work fine.)
>i=$(( ${i} + 1 ))
You can replace this by: (( i += 1 ))
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2012 04:40 AM
01-20-2012 04:40 AM
Re: split with FS a string (filesystem)
hello,
better explanations : the last directory starting from root-directory "/" should get oracle user and permission , the other directories should get root :sys :
/mnt user root:sys
/mnt/db1 user root:sys
/mnt/db1/ORASID user oracle:dba
regards
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2012 11:55 AM
01-20-2012 11:55 AM
SolutionSomething like this, perhaps?
#!/bin/sh DBOWNER=oracle:dba ROOTOWNER=root:sys # set DEBUG="" to actually do the job, or # DEBUG="echo" to just output what would be done DEBUG=echo while [ "$1" != "" ] do DBDIR="$1" $DEBUG chown $DBOWNER $DBDIR PARENT=$(dirname $DBDIR) while [ "$PARENT" != "/" ] do $DEBUG chown $ROOTOWNER $PARENT PARENT=$(dirname $PARENT) done shift done
As is, the script will only display the commands it would run. First verify the script does what you want, then change the line 'DEBUG=echo' to 'DEBUG=""' to make it actually change the permissions instead of displaying the commands.
You can run the script with one or many command-line arguments. For example, if you save the script as ./oraperms.sh and mark it executable:
$ ./oraperms.sh /mnt/db1/ORASID or $ ./oraperms.sh /mnt/db1/ORASID /mnt2/db2/OTHERSID /third/deep/dir/db3/THIRDSID or $ ./oraperms.sh /mnt/db*/*SID
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2012 08:25 PM
01-20-2012 08:25 PM
Re: split with FS a string (filesystem)
>here is my version, I am not happy
It seems to do its job. What do you not like?
And you don't really need: fs_split_ifs="/"
Just always do:
filesystem_split="${filesystem_split}/${filesystem[i]}"