At 13:41 12.9.99 +0200, you wrote:
>Hm... ker sam ne vem ravno veliko o shell skriptah bi rad ce lahko en napise
>eno easy skripto.... Naj bi delala nekaj takega:
>
>gre v /var/log in naredi .tar.gz arhiv in ga shrani v /var/archive... to naj
>bi bilo prvi del... Drugi pa samo ve je mogoce.... da potem zbrise vse tiste
>file in naredi nove prazne..
>
>To skripto bi dav v /etc/cron.weekly
Sam sem recimo naredu nekaj takega, pa narejena je za mesecno uporabo :)
#!/bin/bash
# Purge logs every month...
#
# About author:
# Shell script written by [EMAIL PROTECTED] in March 1998 for KSS
# U may distribute this freely...
#
# All standard disclaimers apply!!!
#
# Some configurable stuff here:
# Dir where logs are..
LOGDIR=/var/log
#
# Dir where old logs should go.. we shell use gzip and timestamp..
OLD_LOGDIR=/var/log/old
#
# Filenames, separated by spaces
LOG_FILES="debug mail_and_news messages syslog wtmp xferlog ppp-log"
#
#
# get the current date...
eval DATE_ENTRY=`date +"%y-%m-%d"`
# ====================================================================
echo "Cleaning logs..."
echo " Date stamp: ${DATE_ENTRY}"
echo -n " Current status: "
#-----------------------------------
for log_file in ${LOG_FILES} ; do
if [ -e ${LOGDIR}/${log_file} ]; then
echo -n "${log_file} "
mv ${LOGDIR}/${log_file} ${OLD_LOGDIR}/${DATE_ENTRY}_${log_file}
echo -n >${LOGDIR}/${log_file}
gzip ${OLD_LOGDIR}/${DATE_ENTRY}_${log_file}
fi
done
echo
# ========================================================================
# Remove junk files..
rm -f /var/log/smb-print.log /var/log/mgetty.ttyC*
# restart the syslogd..
echo " restarting syslogd..."
eval SYSLOGPID=`pidof syslogd`
kill -1 ${SYSLOGPID}
echo All done.
# End
Hob
---
KSS Skofja Loka - System administrator - [EMAIL PROTECTED]
...Life! Don't talk to me about life!