0

I'm probably missing something, but this oneliner in a bash-script to cycle through some scripts that dump data from different sources:

find . -name 'dump-*.sh' -exec {} "$DUMP_LOG" &>>"$DUMP_LOG" \;

will work when I execute the bash-script containing this oneliner directly, but it doesn't work when I invoke it as the cmd_preexec in rsnapshot. It doesn't spawn any errors, it just doesn't do anything.

I tried adding '(/bin/)bash -c', like this:

find . -name 'dump-*.sh' -exec bash -c '{} "$DUMP_LOG" &>>"$DUMP_LOG"' \;

but then I get an error about '(/bin/)bash not existing, even if Irun the script directly.

Ignacio Vazquez-Abrams
  • 776,304
  • 153
  • 1,341
  • 1,358
zenlord
  • 330
  • 3
  • 15

1 Answers1

1

OK, silly me. Of course the first parameter of the find-cmd needs the working directory.

find /usr/local/sbin -name 'dump-*.sh' -exec {} "$DUMP_LOG" &>>"$DUMP_LOG" \;

has solved the problem.

zenlord
  • 330
  • 3
  • 15