Popular Posts

Nov 10, 2019

pacct file log rotation and deletion Solaris

pacct file log rotation and deletion Solaris

APPLIES TO :  Oracle SPARC Solaris

ISSUE :  Process Accounting Files (/var/adm/pacct) files are growing in size and in count as well, there is not proper log rotation in place

GOAL :  Rotate the /var/adm/pacct file and leave only 15 days file in server, delete the old file by having log rotation in place

SOLUTION :  /usr/lib/acct/turnacct script is used to manage the process accounting files in solaris servers, Modify the file based on our requirement and place enable it in daily cron job

Prerequisites :   NIL

               1. Edit the script /usr/lib/acct/turnacct and comment the below line and add the next line
                       root@JUDI-DEV-10:/root # vi /usr/lib/acct/turnacct
                                                      #pfexec /usr/sbin/logadm -p now /var/adm/pacct
                                                      pfexec /usr/sbin/logadm -C 15 -p now /var/adm/pacct
                       -C 15 - is to have only the last 15 files in server at any point in time

               2. Now place the script in cron
                       root@JUDI-DEV-10:/root # crontba -e
                                              0 0 * * * /usr/lib/acct/turnacct switch >/dev/null 2>/dev/null

               3. Now place the script in cron
                       root@JUDI-DEV-10:/root # crontba -e

                                              0 0 * * * /usr/lib/acct/turnacct switch >/dev/null 2>/dev/null


This will rotate the pacct files daily and delete the old files from server which is older than 15. days. 

No comments:

Post a Comment

Popular Posts