Need assistance understanding reading unix script

Posted on 2011-05-09
Last Modified: 2013-11-17
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
                        #/usr/bin/kill -HUP syslogd

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
                        #/usr/bin/kill -HUP syslogd

Question by:assistunix
    LVL 9

    Assisted Solution

    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.


    LVL 48

    Assisted Solution

    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

                            #/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.


    After rotatating, compress the rotated log with gzip.
    LVL 68

    Assisted Solution


    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 , 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).



    Author Comment

    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.

    LVL 68

    Accepted Solution

    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




    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Title # Comments Views Activity
    Help with my python script 6 135
    Automating/Scheduling SFTP Downloads 4 64
    PERL - Find newest folder 12 85
    dot directory in FreeBSD??? 4 47
    Recently, an awarded photographer, Selina De Maeyer (, completed a photo shoot of a beautiful event ( in An…
    Active Directory replication delay is the cause to many problems.  Here is a super easy script to force Active Directory replication to all sites with by using an elevated PowerShell command prompt, and a tool to verify your changes.
    Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…
    Video by: Phil
    This video goes over how to configure and start a jail in FreeBSD.  This video is meant to supplement the article included with this course.

    758 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now