Contents
- INDEX
- HP-UX Index
- Solaris
- Linux Index
- Other Unix types
- General Unix
- Unix Networking
- Unix Scripts
- Unix databases
Associated Information
- Unix Scripts Tips
Useful Links
-
Bash shell HOWTO
- Bourne Shell Man Page
-
C Shell Guide
- Korn Shell Resources
|
copybus5.sh
#!/usr/bin/sh
# copybus5.sh
# Copy a file on the 5th business day of the month.
# A Mon-Fri work week is assumed.
# Example crontab entry to run this script:
#00 23 5-7 * 1-5 /scripts/daily/copybus5.sh #Copy file on 5th business day.
MONTHDAY=`date +%d`
WEEKDAY=`date +%w`
# The first two "if" statements are not necessary IF a crontab entry, as above,
# limits the run days, but are included for safety.
# Exclude weekends.
if [ $WEEKDAY -eq 0 -o $WEEKDAY -eq 6 ]; then
exit
fi
# Exclude month days < 5 or > 7.
if [ $MONTHDAY -lt 5 -o $MONTHDAY -gt 7 ]; then
exit
fi
# The 5th business day is Mon-Fri the 7th or Fri the 5th or 6th.
if [ $MONTHDAY -eq 7 -o $WEEKDAY -eq 5 ]; then
cp /data1/dmp1 /data2/BKUPRPT
fi
#### END OF SCRIPT
|