From: Paul Furness <paul.furness@vil.ite.mee.com>
To: Paul Kraus <pkraus@pelsupply.com>
Cc: linux-newbie@vger.kernel.org
Subject: RE: need method of backing up files
Date: 08 Nov 2002 15:38:09 +0000 [thread overview]
Message-ID: <1036769889.20840.92.camel@zebra.vil.ite.mee.com> (raw)
In-Reply-To: <056b01c28734$2b22b820$64fea8c0@pkrausxp>
Yup, that should work nicely.
Couple of things you might want to add to it (or you may not, of course
:) - see below
On Fri, 2002-11-08 at 14:35, Paul Kraus wrote:
>
> Example: scriptname someuser somepassword computername computershare
> pathwithinshare locationofpst
>
>
> Let me know if you come up with a way to have it remove deleted files.
>
Would you want to? How often does someone delete a file, then a couple
of days later ask you to restore it from the backup? I have something
similar going on where I simply copy stuff to the backup space, but
never delete anything. Well, not strictly; once per month it deletes
everything older than a month, using find:
find /{Backup_Place} -mtime +30 -exec rm {} >> {Log_File} \;
Old stuff is in the regular backups anyhow.
Oh, about logging: The approach I use is to log all activity and all
errors to the same file. This is because I find that if there _are_ any
problems, it's useful to have all the messages in chronological order.
Basically, every command in any of my system scripts ends in " >>
${Log_File} 2>&1 " (actually, I usually do something like assign that
to a variable and stick that on each line).
At then end of the script, I usually put in something like:
mail -s "Backup script on ${Host} completed ok"
paul.furness@vil.ite.mee.com < ${Log}
and if there is a place in the script where things have gone wrong,
rather than just exitting, I put in something like:
mail -s "Backup script on ${Host} FAILED" paul.furness@vil.ite.mee.com <
${Log}
Hope some of this helps.
P.
>
>
> The script in case you care :)
> ------------------------------
> #Backup Script
> #------------
.
.
.
> log=/backup/logs/${workstation}.log.${dt}.txt
> #Check to see if dest paths exists if not create
> if [ ! -d $dest ];then mkdir --parents "$dest";fi
> if [ ! -d $mnt ];then mkdir --parents "$mnt";fi
You might want to add something here that deals with a failure to make
the directory, and also logs the results of the mkdir command. Something
like:
if [ ! -d $dest ];then mkdir -v --parents "$dest" >> ${log};fi
if [ ! -d $dest ]
then
echo "Failure to make destination $dest >> ${log}
#mail an error to someone?
exit 1 # This ends the script if dest doesn't exist
fi
........same for ${mnt}
It is possible to combine these into more compact code, but I think that
makes it harder to read later.
>
> #tMount File Systew
> mount -t smbfs -o username=${uid},password=$pass
> //${workstation}/$share $mnt > $log 2>/dev/null
Is there any reason why you redirect errors to /dev/null rather than
appending to the log file? If it went wrong, you wouldn't know why.
>
.
.
.
.
> fi
--
Paul Furness
Systems Manager
Steepness is an illusion caused by flat things leaning over.
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs
next prev parent reply other threads:[~2002-11-08 15:38 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2002-11-07 6:58 Tkdesk Segmentation Fault Peter
2002-11-07 10:41 ` Elias Athanasopoulos
2002-11-08 2:13 ` Peter
2002-11-08 9:53 ` Elias Athanasopoulos
2002-11-08 11:55 ` need method of backing up files Shaggy Im-erbtham
2002-11-08 13:51 ` Paul Furness
2002-11-08 14:35 ` Paul Kraus
2002-11-08 15:38 ` Paul Furness [this message]
2002-11-08 21:37 ` Paul Kraus
2002-11-18 12:08 ` Paul Furness
2002-11-08 15:09 ` Mr. James W. Laferriere
2002-11-09 2:36 ` Tkdesk Segmentation Fault lawson_whitney
2002-11-10 4:24 ` Peter
2002-11-10 10:22 ` Elias Athanasopoulos
2002-11-11 3:35 ` Peter
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1036769889.20840.92.camel@zebra.vil.ite.mee.com \
--to=paul.furness@vil.ite.mee.com \
--cc=linux-newbie@vger.kernel.org \
--cc=pkraus@pelsupply.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.