1825002 Members
2578 Online
109678 Solutions
New Discussion юеВ

RBAC FOR USER

 
SOLVED
Go to solution
vadivel
New Member

RBAC FOR USER

Need to know the steps to create an user only for deleting archive log files from particular directory and monitoring cron Jobs.
"You Cannot Always Control Circumstances But You Can Control Your Own Thoughts"
6 REPLIES 6
Chandrahasa s
Valued Contributor

Re: RBAC FOR USER

Provide path of log files
what is the interval (24 or 48 hrs old logfiles) you want to delet log files.
Monitoring cron job means what exactly you want to do??


Chandra
Horia Chirculescu
Honored Contributor

Re: RBAC FOR USER

Hello,

> to create an user only for deleting archive log files

Usually, log files are owned by the user that actually start the daemon that generates the logs. Most of them are started by root. You should make a cron job for user root that will do the job.

Why do you want to create another user for this job? You would need to perform some additional steps like su-ing as the users that will have the right to modify that log files.

Horia.
Best regards from Romania,
Horia.
vadivel
New Member

Re: RBAC FOR USER


we need to monitor oracle archive log directory

ex: -

root@IC2DBVR1:/ora_log2/HMIMESV2/arch #ls -lrt
total 37734648
-rw-r----- 1 oracle oinstall 491625472 Mar 9 17:17 HMIMESV2_1_10868_617656652.arc
-rw-r----- 1 oracle oinstall 491633664 Mar 9 18:09 HMIMESV2_1_10869_617656652.arc
-rw-r----- 1 oracle oinstall 491707392 Mar 9 19:57 HMIMESV2_1_10870_617656652.arc
-rw-r----- 1 oracle oinstall 491625472 Mar 9 22:14 HMIMESV2_1_10871_617656652.arc
-rw-r----- 1 oracle oinstall 491627520 Mar 10 00:09 HMIMESV2_1_10872_617656652.arc
-rw-r----- 1 oracle oinstall 491630592 Mar 10 02:01 HMIMESV2_1_10873_617656652.arc
-rw-r----- 1 oracle oinstall 491617280 Mar 10 04:16 HMIMESV2_1_10874_617656652.arc
-rw-r----- 1 oracle oinstall 491635712 Mar 10 06:31 HMIMESV2_1_10875_617656652.arc
-rw-r----- 1 oracle oinstall 491618304 Mar 10 08:34 HMIMESV2_1_10876_617656652.arc
-rw-r----- 1 oracle oinstall 496939008 Mar 10 10:22 HMIMESV2_1_10877_617656652.arc
-rw-r----- 1 oracle oinstall 491639808 Mar 10 11:32 HMIMESV2_1_10878_617656652.arc
-rw-r----- 1 oracle oinstall 491617280 Mar 10 13:32 HMIMESV2_1_10879_617656652.arc
-rw-r----- 1 oracle oinstall 498763776 Mar 10 15:00 HMIMESV2_1_10880_617656652.arc
-rw-r----- 1 oracle oinstall 491716608 Mar 10 15:39 HMIMESV2_1_10881_617656652.arc
-rw-r----- 1 oracle oinstall 491629568 Mar 10 17:29 HMIMESV2_1_10882_617656652.arc
-rw-r----- 1 oracle oinstall 491626496 Mar 10 19:03 HMIMESV2_1_10883_617656652.arc
-rw-r----- 1 oracle oinstall 491654144 Mar 10 21:30 HMIMESV2_1_10884_617656652.arc
-rw-r----- 1 oracle oinstall 491621376 Mar 10 23:32 HMIMESV2_1_10885_617656652.arc
-rw-r----- 1 oracle oinstall 491633664 Mar 11 01:10 HMIMESV2_1_10886_617656652.arc
-rw-r----- 1 oracle oinstall 491626496 Mar 11 03:24 HMIMESV2_1_10887_617656652.arc
-rw-r----- 1 oracle oinstall 491640832 Mar 11 05:35 HMIMESV2_1_10888_617656652.arc
-rw-r----- 1 oracle oinstall 491660288 Mar 11 07:20 HMIMESV2_1_10889_617656652.arc
-rw-r----- 1 oracle oinstall 491635712 Mar 11 09:14 HMIMESV2_1_10890_617656652.arc
-rw-r----- 1 oracle oinstall 491619328 Mar 11 10:57 HMIMESV2_1_10891_617656652.arc
-rw-r----- 1 oracle oinstall 491661312 Mar 11 13:16 HMIMESV2_1_10892_617656652.arc
-rw-r----- 1 oracle oinstall 491625472 Mar 11 15:22 HMIMESV2_1_10893_617656652.arc
-rw-r----- 1 oracle oinstall 495903744 Mar 11 17:04 HMIMESV2_1_10894_617656652.arc
-rw-r----- 1 oracle oinstall 491626496 Mar 11 18:10 HMIMESV2_1_10895_617656652.arc
-rw-r----- 1 oracle oinstall 491638784 Mar 11 20:14 HMIMESV2_1_10896_617656652.arc
-rw-r----- 1 oracle oinstall 491684864 Mar 11 22:31 HMIMESV2_1_10897_617656652.arc
-rw-r----- 1 oracle oinstall 492123136 Mar 12 00:16 HMIMESV2_1_10898_617656652.arc

size when it reaches 70% , need to reduce to 40 -50% instead of deleting sinlge file i need group delete based on date...while using wild card mistakenly deleted all the files in that folder then restored from Tape to manage the situation...it was archive log folder so i managed little bit but to avoid these kind of behaviour need to create specific user to delete the logs from particular dir on daily basis...



IN solaris we can create role based access control like any specific user can access prmission to use particular command only ..like to know about the same in HP- UX...

TX in advance.
Vadivel

"You Cannot Always Control Circumstances But You Can Control Your Own Thoughts"
Horia Chirculescu
Honored Contributor
Solution

Re: RBAC FOR USER

Here is a script that would keep PASTRATE-1 files on some directory. Deleting is performed in the order that the files were created- oldest files first.

This should work as arc files always have the same size, so you can do the math to match your 40-50 percent.

I would suggest to make a cron job for the user oracle and add some logging messages in /tmp

----------------------------------------
PASTRATE=20
DIR=path_to_arc_files

cd $DIR

NR=`ls -t HMI*arc|wc -l`
ARCSET=($(ls -t HMI*arc))


while [ $NR -ge $PASTRATE ]; do
NR=$( expr $NR - 1 );
echo rm -rf `echo ${ARCSET[$NR]}`;
done
-----------------------------------------

Horia.
Best regards from Romania,
Horia.
Horia Chirculescu
Honored Contributor

Re: RBAC FOR USER

>echo rm -rf `echo ${ARCSET[$NR]}`;

I have echoed the actual command for you to know what is happening (what will be the rm command). When happy with it, just remove the first echo (I suppose you know what I am talking about - I can not be pursued for loss of data. Use it at your risk.).

Horia.
Best regards from Romania,
Horia.
vadivel
New Member

Re: RBAC FOR USER

> Horia ...Thanx a lot for your help & suggestion ..BYE.
"You Cannot Always Control Circumstances But You Can Control Your Own Thoughts"