Hi everyone, I don't know if I was the only one with this problem, but I used to get the message "mv: cannot stat `./log/syslog.5': No such file or directory", and the syslog in ./log would skip numbers... Didn't seem to do any harm, was just wierd. So I checked out autorun, and as my first exercise in perl (is it perl?) I modified it as follows. It seems to work fine, let me know if I messed up something critical? On a side note... how do I best go about making patchfiles? Do I do a diff for every modified file, and paste the outputs together? There has to be an easier way... Thanks, Marek - # Find the # to set the new log file to. - if ! [ -s log/syslog.$BACKLOGS ]; then - declare -i newlog=$BACKLOGS+1 - else - declare -i newlog=1 - while [ -s log/syslog.$newlog ]; do newlog=$newlog+1; done - fi - - # Rotate the logs. - declare -i y=2 - while [ $y -lt $newlog ]; do - declare -i x=$y-1 - mv -f log/syslog.$y log/syslog.$x - y=$y+1 - done - mv -f syslog log/syslog.$newlog +# Marek - modified the log rotating, syslog.1 is newest now +# Done to prevent the "cannot stat syslog.x" error + + # If we've already got BACKLOGS number of logs, remove the oldest one + if [ -s log/syslog.$BACKLOGS ]; then + rm log/syslog.$BACKLOGS + fi + + # Rotate the logs. + declare -i y=$BACKLOGS-1 + while [ $y -gt 0 ]; do + declare -i x=$y+1 + if [ -s log/syslog.$y ]; then + mv -f log/syslog.$y log/syslog.$x + fi + y=$y-1 + done + mv -f syslog log/syslog.1 _________________________________________________________________ Join the world’s largest e-mail service with MSN Hotmail. http://www.hotmail.com -- +---------------------------------------------------------------+ | FAQ: http://qsilver.queensu.ca/~fletchra/Circle/list-faq.html | | Archives: http://post.queensu.ca/listserv/wwwarch/circle.html | | Newbie List: http://groups.yahoo.com/group/circle-newbies/ | +---------------------------------------------------------------+
This archive was generated by hypermail 2b30 : 06/25/03 PDT