AnotherAlan
Technical User
Guys, I have written a script that should (!) copy a log, append a date and remove any existing files over 7 days.
This is fairly straightforward, however, as this is going to be put into a live / production system I would very much like the experts to cast an eye over it and let me know if this is OK.
#!/bin/ksh
#
# Copy Meridian Log and delete logs older than 7 days.
#
TODAY=`date +%d/%m/%y | tr -s '/' '-'`
LOG_DIR=/opt/admin/scripts/logcheck
LOG=/opt/admin/scripts/logcheck/file1
[[ -f $LOG ]] && /usr/bin/cp -p $LOG $LOG.$TODAY
/usr/bin/find $LOG_DIR -mtime +7 -exec rm {} \; >/dev/null
Any help / ideas would be gratefully received.
Thanks
Alan
This is fairly straightforward, however, as this is going to be put into a live / production system I would very much like the experts to cast an eye over it and let me know if this is OK.
#!/bin/ksh
#
# Copy Meridian Log and delete logs older than 7 days.
#
TODAY=`date +%d/%m/%y | tr -s '/' '-'`
LOG_DIR=/opt/admin/scripts/logcheck
LOG=/opt/admin/scripts/logcheck/file1
[[ -f $LOG ]] && /usr/bin/cp -p $LOG $LOG.$TODAY
/usr/bin/find $LOG_DIR -mtime +7 -exec rm {} \; >/dev/null
Any help / ideas would be gratefully received.
Thanks
Alan