• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 441
  • Last Modified:

Need assistance understanding reading unix script

Hello,
For AIX.
I need assistance in understanding this script
The following script has been created to prevent the file /var/adm/cron/log file size from getting too big, clearing up old info in it. But i would like to understand what each parameter and part of script means.?

/var/adm/cron/log {
        rotate 5
        daily
        size=4000k
        postrotate
                        #/usr/bin/kill -HUP syslogd
        endscript
        compresscmd=/usr/bin/gzip
        compress
        }


If i need to apply this script to contain the size of another file /var/login.log file, can i use the same parameters. as follows.

/var/login.log {
        rotate 5
        daily
        size=4000k
        postrotate
                        #/usr/bin/kill -HUP syslogd
        endscript
        compresscmd=/usr/bin/gzip
        compress
        }


0
assistunix
Asked:
assistunix
4 Solutions
 
sshah254Commented:
I think,

rotate 5 => keep 5 weeks worth of log files
daily => rotate log files daily
size = 4000K => rotate the log file when it grows larger than 4000k
postrotate => do these things after rotation

In this case /usr/bin/kill -HUP syslogd (kill the syslogd daemon) has been commented out.

The directives
compress => compress the files
compresscmd => how to comress the files

Yes, you should be able to add the other script also.

Ss

0
 
TintinCommented:
What you posted isn't a script, it's one of the configuration files for the logrotate utility.


rotate 5             # Keep a maximum of 5 copies
daily                  # Rotate/check daily
size=4000k      # Rotate when the log size is over 4000k

        postrotate
                        #/usr/bin/kill -HUP syslogd

After rotation, send a SIGHUP signal to syslogd.  This causes syslogd to re-read its configuration, close/open files.  If you don't do this step, then syslog will continue writing to the rotated log.

        endscript
        compresscmd=/usr/bin/gzip
        compress

After rotatating, compress the rotated log with gzip.
0
 
woolmilkporcCommented:
OK,

all correct, but here are some remarks nonetheless.

1) Starting with AIX 5.3 TL 7 you don't have to rotate cron's log via logrotate anymore. cron now has its own logrotation facility, governed by /etc/cronlog.conf. The comments in this file plus "man cronlog.conf" contain everything one needs to know to make cron's own logrotation work.

2) cron's logging is not carried out via syslogd, so there's no need to restart it.
The command is wrong anyway, because "kill" expects a process id as a parameter, not a process name.
Fortunately it's AIX, so if you really have to restart syslogd somewhere simply use
refresh -s syslogd

3) /usr/bin/gzip is not part of the AIX base. You'll have to install it from the toolbox or from http://www.perzl.org , but I think you're aware of this.

4) As for your new configuration: /var/login.log is not part of the AIX standard. Whre does it come from? If it's under control of syslogd (check with "lssrc -ls syslogd" if it's there) you will indeed have to restart syslogd. Do this the way I suggested above (the "refresh -s syslod" thing).

wmp

0
 
assistunixAuthor Commented:
Thanks All.

Actually the correct file name for new configuration file is /logs/extlogin.access. Would you happen to know if /logs/extlogin.access is part of AIX standard and if i need to add refresh -s syslod for it.

0
 
woolmilkporcCommented:
No, that's not AIX standard either. Not even the directory /logs itself is AIX standard.

Is /logs an own filesystem? I hope so! Please remember:  not too many user data under / !

As I wrote, under AIX you can check easily what syslogd does, with

lssrc -ls syslogd

Look for the filename  /logs/extlogin.access. If it's not there - no syslog.

You could then try

fuser -f /logs/extlogin.access

Any PID displayed after the colon (:)? If so, what does

ps -ef | grep PID

say?

wmp

0

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now