Use the script in crontab. Lets say your script is called log_rotate.sh

You would write this in crontab:

0 0 30 * * /usr/local/bin/log_rotate.sh

this would run the script  log_rotate.sh at midnight every 30th day of the
month

Anthony


On Thu, Dec 8, 2011 at 4:09 PM, mwamba chishimba <[email protected]> wrote:

> Hi Stanic,
>
> If I want to do log rotation every month what do I need to do?
>
> Kind Regards,
>
>
> On Thu, Dec 8, 2011 at 11:20 AM, Milan P. Stanic <[email protected]> wrote:
>
>> On Thu, 2011-12-08 at 16:00, JAmes wrote:
>> > That sounds good.
>> >
>> > So in fact we can use this logrotate method without loosing any SMS in
>> the
>> > process?
>>
>> I'm using it for years on three different systems and I didn't lost
>> single SMS because of this method for log rotation.
>>
>> > J
>> >
>> > On Thu, Dec 8, 2011 at 3:57 PM, Milan P. Stanic <[email protected]>
>> wrote:
>> >
>> > > On Thu, 2011-12-08 at 15:50, JAmes wrote:
>> > > > Killing the bb process like that could lead to issues if you have a
>> > > > constant flow of traffic going through it, as it might kill it
>> while its
>> > > in
>> > > > the middle of processing an SMS.
>> > > >
>> > > > Am I correct?
>> > >
>> > > Kannel just reopens log files when it 'receives' HUP (hang up) signal
>> > > and does not shutdown or hang up really.
>> > >
>> > > > On Thu, Dec 8, 2011 at 3:28 PM, Joel Westerberg <[email protected]>
>> wrote:
>> > > >
>> > > > > I think it'd be best to use the logrotate daemon if you're
>> hosting on a
>> > > > > unix system (not doing logrotate yet though, but will once I move
>> to
>> > > > > production).
>> > > > >
>> > > > > http://www.kannel.org/pipermail/users/2007-October/003108.html
>> > > > >
>> > > > >  /your_path/kannel.log /your_path/sqlbox.log
>> /your_path/smsbox.log {
>> > > > >        daily
>> > > > >        missingok
>> > > > >        rotate 100
>> > > > >        size=50M
>> > > > >        compress
>> > > > >        delaycompress
>> > > > >        olddir /your_path/oldlogs
>> > > > >        notifempty
>> > > > >        create 640 root root
>> > > > >        sharedscripts
>> > > > >        postrotate
>> > > > >              killall -HUP bearerbox sqlbox smsbox || true >
>> /dev/null
>> > > 2>
>> > > > > /dev/null
>> > > > >        endscript
>> > > > > }
>> > > > >
>> > > > >
>> > > > >
>> > > > > On 8 dec 2011, at 09.21, [email protected] wrote:
>> > > > >
>> > > > > Yes. From command line, I close smsbox>sqlbox>bearerbox (in
>> order),
>> > > move
>> > > > > the logs out of folder, and then restart bearerbox>sqlbox>smsbox.
>> > > Brearebox
>> > > > > creates all new files when it finds out no log files in the log
>> > > directory.
>> > > > >
>> > > > > On Thu, Dec 8, 2011 at 1:18 PM, JAmes <[email protected]> wrote:
>> > > > >
>> > > > >> Hi,
>> > > > >>
>> > > > >> So you issue the admin command: shutdown, then move configs, then
>> > > admin
>> > > > >> command restart?
>> > > > >>
>> > > > >> Regards,
>> > > > >> J
>> > > > >>
>> > > > >> On Thu, Dec 8, 2011 at 3:06 PM, Sean Brady <[email protected]>
>> > > wrote:
>> > > > >>
>> > > > >>>   clone your server. ;P   rsync everything, and then change
>> > > config....
>> > > > >>>
>> > > > >>>
>> > > > >>>
>> > > > >>>
>> > > > >>> Thank you,
>> > > > >>> Sean Brady
>> > > > >>> [email protected]
>> > > > >>> http://www.simpletechnology.us/
>> > > > >>> +1 ( 256 ) 542-1429
>> > > > >>>
>> > > > >>>
>> > > > >>> aim - cesurasean
>> > > > >>> yahoo - cesurasean
>> > > > >>> google - [email protected]
>> > > > >>> msn - [email protected]
>> > > > >>> icq - 357464121
>> > > > >>> skype - cesurasean
>> > > > >>> sip:[email protected]
>> > > > >>>
>> > > > >>>  *From:* JAmes <[email protected]>
>> > > > >>> *Sent:* Thursday, December 08, 2011 12:49 AM
>> > > > >>> *To:* [email protected]
>> > > > >>> *Subject:* Log Rotation
>> > > > >>>
>> > > > >>> Hi,
>> > > > >>>
>> > > > >>> What the best way to rotate the logs without interrupting
>> kannel and
>> > > > >>> making bb, sqlbox etc still write to the logs?
>> > > > >>>
>> > > > >>> For example, if we move the log files, zip them, archive etc, bb
>> > > doesnt
>> > > > >>> create a new log file. Is there a better way?
>> > > > >>>
>> > > > >>> J
>> > > > >>>
>> > > > >>> No virus found in this message.
>> > > > >>> Checked by AVG - www.avg.com
>> > > > >>> Version: 2012.0.1873 / Virus Database: 2102/4666 - Release Date:
>> > > 12/07/11
>> > > > >>>
>> > > > >>
>> > > > >>
>> > > > >
>> > > > >
>> > >
>> > > --
>> > > Kind regards,  Milan
>> > > --------------------------------------------------
>> > > Arvanta, IT Security        http://www.arvanta.net
>> > > Please do not send me e-mail containing HTML code or documents in
>> > > proprietary format (word, excel, pps and so on)
>> > >
>> > >
>>
>> --
>> Kind regards,  Milan
>> --------------------------------------------------
>> Arvanta, IT Security        http://www.arvanta.net
>> Please do not send me e-mail containing HTML code or documents in
>> proprietary format (word, excel, pps and so on)
>>
>>
>
>
> --
> Mwamba Chishimba
>
> "For I am persuaded, that neither death, nor life, nor angels, nor
> principalities, nor powers, nor things present, nor things to come, nor
> height, nor depth, nor any other creature, shall be able to separate us
> from the love of God, which is in Christ Jesus our Lord"
>

Reply via email to