[wellylug] bash scripting help

Mark Signal mark at databackup.co.nz
Wed Aug 4 16:56:45 NZST 2004


Thanks Tony and Jai for your input

the script fragment solved the problem perfectly.

...and Tony your signature is simply showing off (he says with a green
tinge)

cheers

Mark  (echo znex at qngnonpxhc.pb.am | sed
y/nopqrstuvwxyzabcdefghijklm/abcdefghijklmnopqrstuvwxyz/)




-----Original Message-----
From: wellylug-admin at lists.naos.co.nz
[mailto:wellylug-admin at lists.naos.co.nz]On Behalf Of jumbophut
Sent: Wednesday, 4 August 2004 1:27 p.m.
To: wellylug at lists.naos.co.nz
Subject: Re: [wellylug] bash scripting help


On Wed, 04 Aug 2004 12:18:07 +1200, Mark Signal wrote:
> if you are still with me... what I need to do is ensure that the rm -rf
> portion of the rsync script only runs on the first time that the scrip is
> run each day.
>
> Maybe I could create a unique token file at the end of the first days
rsync
> and check for it each time rsync is run..
>
<snip>
> I am unsure if this is the best way to do this and how exactly to script
the
> if-compare-then part of it.
>
I am also unsure of whether this is the best way, but I have done
something similar with a backup script before:

Excerpt from:
<http://wellylug.org.nz/index.php?page=articles/article-display.php&&id=10>

working_dir="/tmp/backup/$(date +%Y%m%d)/"
...
if [ ! -d $working_dir ]; # check directory does not exist already
then mkdir -p $working_dir;
else
  echo
  echo "Not proceeding because $working_dir exists! If there is nothing "
  echo "important in that directory, delete the directory and rerun
this script."
  echo
  exit;
fi;

Hope that helps.

--
Tony (echo 'spend!,pocket awide' | sed 'y/acdeikospntw!, /l at omcgtjuba.phi/')


--
Wellington Linux Users Group Mailing List: wellylug at lists.naos.co.nz
To Leave:  http://lists.naos.co.nz/mailman/listinfo/wellylug

---
Incoming mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.733 / Virus Database: 487 - Release Date: 2/08/2004

---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.733 / Virus Database: 487 - Release Date: 2/08/2004




More information about the wellylug mailing list