Thanks Adam,
I tried the -f option within BackupPC, not in a script, and the backup
would work but the old files where not deleted.
I gather it passes an exit status 0 to UserCmdCheckStatus. 


On Fri, 2008-10-24 at 02:15 +1100, Adam Goryachev wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 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.
> 
> Or you could do it in two lines:
> #!/bin/bash
> rm -f /archives/*
> 
> Or you could do it in three lines:
> #!/bin/bash
> touch /archives/test
> rm -f /archives/*
> 
> Or you could do it like this (approx)
> #!/bin/bash
> find /archives/ -type f -exec rm -f {}
> (I never seem to get my find -exec commands to work properly, but it
> should work if you get the parameters right.
> 
> BTW, keep in mind /archives/* will never match /archives/.somefile etc
> 
> Finally, like all things in unix, there are dozens of ways to solve a
> problem :)
> 
> PPS, for most of the above "scripts" you probably don't need the
> #!/bin/bash on the first line, because it doesn't matter which shell
> interprets the commands, they should all "do the right thing"....
> 
> BTW, "man rm" will provide some hints on how to use the rm command,
> including using -f "ignore nonexistent files, never prompt"
> 
> Regards,
> Adam
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.6 (GNU/Linux)
> Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org
> 
> iD8DBQFJAJUrGyoxogrTyiURAouuAJ9ZqEdLWxZpkgKJprU2ntouYXGiMQCgjMiD
> cgTD1XJXzcSaO8udA3hjslw=
> =wKQq
> -----END PGP SIGNATURE-----
> 
> -------------------------------------------------------------------------
> 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
> [email protected]
> List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
> Wiki:    http://backuppc.wiki.sourceforge.net
> Project: http://backuppc.sourceforge.net/
-------------------------------------------------------------------------
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
[email protected]
List:    https://lists.sourceforge.net/lists/listinfo/backuppc-users
Wiki:    http://backuppc.wiki.sourceforge.net
Project: http://backuppc.sourceforge.net/

Reply via email to