At 03:51 PM 2/13/97 -0500, Pam Skillman wrote:
On Thu, 13 Feb 1997, James Beal wrote:
...
I think you can lock both of these; I'm only answering because I
haven't seen another answer, and I can't test this, so if someone
says I'm wrong, you should believe them I think! :-)
...
HOWEVER... I think what I just suggested will also allow only one
filing to Backup at a time. If your volume is high enough to make
that unacceptable, then maybe someone else can suggest something
better.
So -- assuming that I'm using bash -- does this
script look right?
##### Begin ~/bin/daily #######
#! /bin/bash
## Daily tasks
tday=`date +%Y%m%d`
cd ~/mh/backup || exit 1
lockfile today.lock || exit 1
trap "rm -f today.lock" 0
mv today $tday
rm -fr today.lock && trap -
gzip -9 $tday
find *.gz -maxdepth 0 -type f -mtime +30 -print0 | xargs -0 rm
exit 0
##### End of ~/bin/daily #####
(I guess I'll find out in a few minutes if it does
what I expect).
This is intended to name my backup files in the form
19970213 (today's date) -- 19970214 (tomorrow's) etc.
(that part's been working for a week).
What I've just added is the locking (which I'd neglected)
and the gzip part and expiration line and the "trappings"
(so to speak).
--
Jim Dennis,
info(_at_)mail(_dot_)starshine(_dot_)org
Proprietor,
consulting(_at_)mail(_dot_)starshine(_dot_)org
Starshine Technical Services http://www.starshine.org