[GoLUG] New additions to my bupsky script
Steve Litt
slitt at troubleshooters.com
Wed Jan 15 02:39:20 EST 2025
Hi all,
Sometimes I want to back up the directory I'm working in, but it's not
ready for a git entry. That's when I use bupsky. I've been using it
since at least as early as 2009. It backs up the current directory and
everything under it, with a timestamp. All I do is type ./bupsky and
then keep on going, without losing my train of thought.
A bupsky feature I've long wished for is the ability to write a very
small comment, so when one of these quick backups is important or I
might need to go back to a specific backup, I can do so.
Tonight I put that feature in bupsky. I'll put the code here, but
keep in mind there's no warranty and I bear no responsibility for
the results. Here's the code:
===========================================================
#!/bin/ksh
buptrunk=/scratch/bup
makemsg(){
msg=""
us="_"
while test "$1" != ""; do
msg="$msg$us$1"
shift
done
}
makemsg "$@"
curdir=$(pwd | sed -e "s/.*\///")
bupdir=$buptrunk/$curdir
now=$(date +%Y%m%d_%H_%M_%S)
src=../$curdir
dst=$bupdir/${curdir}_$now$msg
if test ! -d "$bupdir"; then
mkdir "$bupdir"
fi
cp -RpL "$src" "$dst"
echo backup written to "$dst"
===========================================================
Your $buptrunk will probably be different from mine, so just replace it
with the root of all your intended bupsky backups. Have fun with it.
SteveT
Steve Litt
http://444domains.com
More information about the GoLUG
mailing list