1#!/bin/bash 2# 3# This script removes old bsy files, empty .sep & .pnt dirs from outbound. 4# 5# Copyright 2000 Victor Sergienko singalen@mail.ru 2:464/118 vs@balance.dp.ua 6# You're totally free to do anything with this software 7# except of bothering author for anything except thanks: 8# I dont want to hear any complains. Dont use it if it can harm you. 9# You're warned. Bye and kisses. 10# 11 12OUTB_DIR=/home/fido/out 13LOCK_DIR=/var/lock 14LOCK_FILE=LCK..ttyS0 15 16for adir in `ls -d $OUTB_DIR/*.pnt ; echo $OUTB_DIR` ; do 17 ls $adir/{*.spl,*.bsy} 1>/dev/null 2>/dev/null 18 RC=$? 19 if [ x$RC == x0 ] ; then 20 for afile in `ls $adir/{*.spl,*.bsy} 2>/dev/null` ; do 21 if [ $LOCK_DIR/$LOCK_FILE -nt $afile ] ; then 22 date +"%H:%M:%S %d %b" 23 echo " Removed stale file: $afile" 24 rm -f $afile 25 fi 26 done 27 fi 28 ls $adir/* 1>/dev/null 2>/dev/null 29 RC=$? 30 if [ x$RC != x0 ] ; then 31 date +"%H:%M:%S %d %b" 32 echo " Removed empty dir: $adir" 33 rmdir $adir 34 fi 35done 36 37for adir in `ls -d $OUTB_DIR/*.sep ; ls -d $OUTB_DIR/*.pnt/*.sep` ; do 38 ls $adir/* 1>/dev/null 2>/dev/null 39 RC=$? 40 if [ x$RC != x0 ] ; then 41 date +"%H:%M:%S %d %b" 42 echo " Removed empty dir: $adir" 43 rmdir $adir 44 fi 45done 46