[prog] bash scipt question

Tricia Bowen tricia.bowen at gmail.com
Mon Jul 28 14:29:34 UTC 2008


Hi Chris,
Can you provide some additional debugging information? Are you trying the -d
option for logrotate? Can you get the barebones of logrotate to work?
Something in the logrotate config file like:

"/home/snmp/logs/snmp.log" {
           rotate 5
           size=10k
           postrotate
                                     pkill snmp_collect
           endscript
       }
Also, how are you running your snmp_collect.sh script? Is it running as a
cronjob?
--Tricia
On Mon, Jul 28, 2008 at 3:47 AM, Chris Henderson <henders254 at gmail.com>wrote:

> I am writing a script that will collect SNMP information from a switch
> to a log file; once the file reaches
> "x" bytes, it will stop the process, rotate the log (via logrotate)
> and will start the process again.
> I am having some issues with rotating the logs and starting the
> process again. Here's my script -
>
> # call the snmp collect script
> BINARY="/home/snmp/snmp_collect.sh"
>
> EGREP="/usr/bin/egrep"
> OPTIONS="ipaddress|macaddress"
>
> LOG="/home/snmp/logs/snmp.log"
>
> $BINARY | $EGREP | $OPTIONS > $FILE 2>&1 &
>
> if ["`ls -al $LOG | awk '{print $5}'`" -gt "10485760"]; then
>  pkill snmp_collect
>  logrotate to snmp.log.1
>  <start collecting log again until the log file reaches "x" bytes"
> fi
>
> Any help would be much appreciated. Thanks.
> _______________________________________________
> Programming mailing list
> Programming at linuxchix.org
> http://mailman.linuxchix.org/mailman/listinfo/programming
>



-- 
--Tricia


More information about the Programming mailing list