BackupPC-users

Re: [BackupPC-users] rm command does not work in ArchivePreUserCmd

2008-10-23 11:25:57
Subject: Re: [BackupPC-users] rm command does not work in ArchivePreUserCmd
From: Peter McKenna <peter.mckenna AT bitt.co DOT nz>
To: "General list for user discussion, questions and support" <backuppc-users AT lists.sourceforge DOT net>
Date: Fri, 24 Oct 2008 04:23:13 +1300
That works for a directory with files in it but failed if the directory was empty. exit 0 at the end seems to work in all cases.
Thanks again for your help and the same to Adam.
Regards,
Peter


On Thu, 2008-10-23 at 17:03 +0200, Tino Schwarze wrote:
On Fri, Oct 24, 2008 at 03:51:55AM +1300, Peter McKenna wrote:
> Tried that, but no difference.
> Executing ArchivePreUserCmd: /usr/local/bin/archivepreusercmd.sh
> 
> rm: cannot remove `/archives/*': No such file or directory
> Archive failed: ArchivePreUserCmd returned error status 256

Ah, I see. Fact is that there is no file '/archives/*'. Try the
following as /usr/local/bin/archivepreusercmd.sh:

#!/bin/bash
#

for file in /archives/* ; do
  [ -f "$file" ] && rm -f "$file"
done

This ensures that there is actually something to delete.

HTH!

Tino.

-------------------------------------------------------------------------
This SF.Net email is sponsored by the Moblin Your Move Developer's challenge
Build the coolest Linux based applications with Moblin SDK & win great prizes
Grand prize is a trip for two to an Open Source event anywhere in the world
http://moblin-contest.org/redirect.php?banner_id=100&url=/
_______________________________________________
BackupPC-users mailing list
BackupPC-users AT lists.sourceforge DOT net
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/