Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Apr 1998 13:03:29 -0600
From:      Alejandro Galindo <agalindo@servidor.exsocom.com.mx>
To:        David Kelly <dkelly@hiwaay.net>
Cc:        freebsd-questions@FreeBSD.ORG
Subject:   Re: newsyslog process 
Message-ID:  <1.5.4.32.19980419190329.0071e92c@exsocom.com.mx>

next in thread | raw e-mail | index | archive | help
Thanks David, i put your code in a separate file (only for control the
number of  wtmp.x  files, in your code the "x" are the date and i need a
number (a consecutive number) )  then i call the program from the crontab;
and its works like i want. 

Thank you very much
Alejandro

At 06:12 PM 18/04/98 -0500, you wrote:
>You are trying to do it the hard way.
>
>Alejandro Galindo writes:
>> Hellow, i need to configure a separate newsyslog process for the next task:
>> 
>> every day 6 of the week i need to run the newsyslog for rotate the file wtmp
>> 
>> in the cron tab file i put the next line
>> ---------cut here---------
>> 0 0 * * 6 root /usr/local/bin/mynewsyslog
>> ---------cut here---------
>> 
>> the mynewsyslog file are the next:
>> 
>> -------cut here---------
>> #!/usr/local/bin/perl
>> # Rotate the wtmp actual file
>> system("/usr/sbin/newsyslog -f /etc/newsyslog.wtmp");
>> -------cut here---------
>
>First "hard way" shown above. Rather than create a "mynewsyslog", 
>simply run "/usr/sbin/newsyslog -f /etc/newsyslog.wtmp" from the 
>crontab. However there is an even simpler way.
>
>> i need to rotate the file exactly at 00:00 hrs in the day 6 of the week, and
>> in the last file i specify the time = 0  (0 hrs).
>
>Newsyslog runs and decides *if* the files in its config need to be 
>rotated. You want the file to be rotated no matter what, so why don't 
>you simply rotate it in the crontab?
>
>0 0 * * 6 root umask 2; DATE=`date +\%Y\%m\%d`; mv /var/log/wtmp \
>/var/log/wtmp.$DATE; touch /var/log/wtmp; chown root.bin /var/log/wtmp;\
>gzip /var/log/wtmp.$DATE
>
>You might not have to umask or chown as shown above, it doesn't hurt. 
>The above idea was borrowed from SGI's root crontab. Lately I've been 
>considering porting newsyslog to SGI, or using the perl lumberjack.
>
>Hmmm. Checking recent sources I see rotation of wtmp is no longer 
>handled by newsyslog but happens in /etc/monthly. Guessing this is so 
>monthly accounting works right.
>
>nospam: {261} pwd      
>/usr/src/etc
>nospam: {262} ls -l monthly newsyslog.conf
>-rw-r--r--  1 root  wheel  527 Feb  9 05:44 monthly
>-rw-r--r--  1 root  wheel  570 Apr 16 20:02 newsyslog.conf
>nospam: {263}
>
>--
>David Kelly N4HHE, dkelly@nospam.hiwaay.net
>=====================================================================
>The human mind ordinarily operates at only ten percent of its
>capacity -- the rest is overhead for the operating system.
>
>
>
>To Unsubscribe: send mail to majordomo@FreeBSD.org
>with "unsubscribe freebsd-questions" in the body of the message
>
>
 
 ----------------------------------------------------------------------------
|                                                          ,        ,        |
|                                                         /(        )`       |
|                                                         \ \___   / |       |
|                                                         /- _  `-/  '       |
|                                                        (/\/ \ \   /\       |
|     ExSoCom Dgo. MEXICO                                / /   | `    \      |
|                                                        O O   ) /    |      |
|                                                        `-^--'`<     '      |
|                                                       (_.)  _  )   /       |
|     Alejandro Galindo Chairez                          `.___/`    /        |
|     Tel: (52 18) 179177                                  `-----' /         |
|     Fax: (52 18) 179177                     <----.     __ / __   \         |
|                                             <----|====O)))==) \) /====     |
|    e-mail agalindo@exsocom.com.mx           <----'    `--' `.__,' \        |
|                                                          |        |        |
|          http://www.exsocom.com.mx                       \       /       /\|
|                                                     ______( (_  / \______/ |
|                                                   ,'  ,-----'   |          |
|                      a FreeBSD user               `--{__________)          |
 ----------------------------------------------------------------------------


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1.5.4.32.19980419190329.0071e92c>