Logging

G'day

Just wondering if anyone out there knows how to log files, using the example I provided in the earlier message / question earlier today:
:confused:
If I was to backup a file, how could I setup a log file to record the filename, date (This one I've got figured), and that the file was backed-up (Or restored)?
:confused:
Any help on this topic would be greatly appreciated

Cheers and Beers

Aussie_Bloke

Well, several different ways...
It depends on what you're using to backup / restore, and how you want it to work. One way if you're using tar is:

tar vcf /dev/rmt/0m files* >/path/to/log 2>&1

Or if you're allowing a user to add a definite set of files (one or many), you could do:

for each in $file_list
do
echo "$each -- `date`" >/path/to/log
# assuming you're adding to an already created tarball:
tar rf /dev/rmt/0m $each 2>/path/to/log
done

Can you give more details? What Unix system? What backup software are you using?

Hi Aussie_Bloke

filename=<filename to be backed up or restored>
backup_log=<name of backup logfile>
back_rest=<backup or restore as appropriate>
backup_time=`date`
echo "$filename" "$backup_time" "$back_rest">> $backup_log

Cheers
Helen:)

Hey LivinFree

As far as I can tell, I'm using Sun 5.6, in a Bourne Shell script.

The whole purpose of the program is to create copies of files in a /backup directory with a .bak extension added to it.

I'm not actually using a backup prgram to perform these operations, its really just copying file A to location B with a .bak extension thrown on to it.

By the way, thanks Helen, you're suggestion was the one I was looking for, although thankyou LivinFree for the advice

Thanks all

Aussie_Bloke

Dear Aussie,

For logging, errors you can use this at the end of your tar command. " > tar.status.log 2> tar.error.log" this will capture all error messages

If you are writing to tape, You can also use the "tar -t /dev/rmt/0mn > filename "option to print out the table of the files on a tape. If you just want the names of what went to the tape after the backup completes. To compare to what should have been backed up. Also, you can create a file to use as a template for what should be backed up.

Your syntax may differ.

:wink: