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 -->
  #4 (permalink)  
Old 10-13-2008
Annihilannic Annihilannic is offline Forum Advisor  
  
 

Join Date: May 2008
Location: Sydney, Australia
Posts: 1,009
Just change the beginning like this. Today is 14165 days since the epoch, and 14165 % 15 = 5. That means this script will run today, and in 15 days time, 30 days, 45, etc.


Code:
#!/bin/ksh

days_since_epoch=$(perl -e 'print int(time/86400);')

if [[ "$(( $days_since_epoch % 15 ))" -ne 5 ]]
then
    exit
fi

...