Execute script in FileSet

27 views
Skip to first unread message

Frank Cherry

unread,
Dec 25, 2020, 6:11:01 AM12/25/20
to bareos-users
Hello there,
my goal is, to backup only files, created of today.

This is my FileSet:

FileSet {
  Name = "Storage1PVE"
  Description = "PVE backups from GlusterFS"
  Include {
    Options {
      Signature = MD5 # calculate md5 checksum per file
      Compression = LZ4
      noatime = yes
    }
    File = "|sh -c 'find /mnt/glusterfs/pve_dump/dump/ -type f -mtime -1 -name \"*.zst\"'"
  }
}

When I execute it on the client, I get display the right files.
But when I start a job in Bareos, I get:

bareos-dir JobId 13: Fatal error: Error running program: sh -c 'find /mnt/glusterfs/pve_dump/dump/ -type f -mtime -1 -name "*.zst"'. ERR=Child exited with code 1


What I'm doing wrong?

Spadajspadaj

unread,
Dec 25, 2020, 9:18:49 AM12/25/20
to bareos...@googlegroups.com

First of all, you didn't the docs carefully.

If you say 'File = "|command"', said command will be run by the director, on the director machine and - what's important if it's the same machine - in the context of bareos-dir user.

So if you want to run the comand on the client, you have to give it not as "|command", but as "\\|command".

Additionally to that you might - depending on your installation - encounter some problems with PATH variable or proper escaping so I'd suggest wrapping your command into a simple script, putting it in /usr/local/sbin on the client machine (let's say - myscript.sh) and putting 'File = "\\|/usr/local/sbin/myscript.sh"' into the fileset resource.

--
You received this message because you are subscribed to the Google Groups "bareos-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to bareos-users...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/bareos-users/c5806bea-9612-4e96-8bf9-9c5a2251f845n%40googlegroups.com.

Frank Kirschner

unread,
Dec 25, 2020, 12:14:05 PM12/25/20
to bareos...@googlegroups.com
Thanks Spadajspadaj,

You're absolutely right, I haven't read the docs carefully.
With your useful hints, the test backup was successful.
Thanks also for your opinion about placing the command into a file,
placed on the client.
This would be a good solution for database backup on the next step about
learning to work with Bareos.

Thanks a lot, Frank
Reply all
Reply to author
Forward
0 new messages