The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #3 (permalink)  
Old 10-13-2008
ali560045's Avatar
ali560045 ali560045 is offline
Registered User
  
 

Join Date: Oct 2007
Posts: 328
yes script has to run every 15days. if it rans today i.e. 13th oct, next would be on 28th oct and again 0n 13th nov.

I have below given the script details,can u tell me how to implement this date logic inside my script

-------------------------------------------------------------------------

#!/bin/ksh

cd /var/preserve

count=0
count=`ls -ltr | grep ^- | grep 'pipe' | wc -l`


if [ $count -eq 0 ]
then
echo "0 Files are owned by pipe"
else
echo "total files owned by pipe is $count"
ls -ltr | grep 'pipe' | xargs rm -f -
echo "All pipe files are deleted"
fi
-------------------------------------------------------------------------

i know of a command that will give the date after 15days, but not getting the logic to implement it inside the script

TZ=`date +%Z`-360 ;a=`date +%Y-%m-%d`--------> 2008-10-28