Waiting for a client

33 views
Skip to first unread message

Spadajspadaj

unread,
Nov 12, 2019, 1:59:52 AM11/12/19
to bareos-users
Hi there.

I added a laptop client to my bareos setup and everything runs mostly
fine except for the fact that if the job is scheduled for - let's say -
9pm, it tries to run, tries to connect to fd and since the laptop is
down, the job fails.

I was wondering how I can avoid those failed jobs and possibly have
bareos server wait for a client to appear.

I pondered two options:

1) Have completely manual "schedule", so the job never runs on its own.
I need to manually run the job every time I have a laptop available in
my network. But I'm not sure I can specify a schedule which never runs
on its own. Is it even possible? Or

2) Have bareos server wait for the fd to appear on the network. Now
that's trickier. I thought about writing a script and running it as a
pre-job script effectively delaying start of the job itself until I can
reach the fd but:

a) I'm not sure if the pre-job script is run before the initial
connection to fd or after. (haven't tried it yet; just thought about it
today driving to work :-)) and

b) If I understand correctly, such job with a pre-job script would
effectively block other jobs from running in the same time, right? So if
I have a schedule for all jobs to start at 9pm, then other jobs (for now
let's not complicate matters with priorities) would wait for my script
to time-out with the Max Run Time limit?

Any other ideas?

What I would ideally want to achieve is to have bareos do a backup of my
laptop when it gets available on the network (when I come back home and
power on the laptop) but of course not more than once a day.

Of course I can (and probably will if there are no other options) do an
external script which probes the network for the laptop and if found
runs the apropriate job but I was wondering if I can do something like
that "from within" bareos.


Regards,

MK


Jörg Steffens

unread,
Nov 12, 2019, 3:11:29 AM11/12/19
to bareos...@googlegroups.com
On 12.11.19 at 07:59 wrote Spadajspadaj:
You can solve this with a combination of
https://docs.bareos.org/TasksAndConcepts/NetworkSetup.html#client-initiated-connection
and the external script
https://github.com/bareos/bareos-contrib/blob/master/misc/triggerjob/triggerjob.py
run by cron.

Triggerjob will look for all clients connected to the Director.
If is finds a job named backup-{clientname} that did not successfully
run during the specified time period, it will trigger this job.

The upcoming Bareos 19.2.4 will also add an additional feature to the
Bareos core.

Regards,
Jörg


--
Jörg Steffens joerg.s...@bareos.com
Bareos GmbH & Co. KG Phone: +49 221 630693-91
http://www.bareos.com Fax: +49 221 630693-10

Sitz der Gesellschaft: Köln | Amtsgericht Köln: HRA 29646
Komplementär: Bareos Verwaltungs-GmbH
Geschäftsführer:
S. Dühr, M. Außendorf, Jörg Steffens, P. Storz

Spadajspadaj

unread,
Nov 12, 2019, 3:42:53 AM11/12/19
to bareos...@googlegroups.com
Thanks for suggestions. I'll look into it :-)

MK


Javier Back

unread,
Nov 12, 2019, 3:00:54 PM11/12/19
to bareos...@googlegroups.com
I found a solution for my own backups by using the retry approach.   I
placed these directives in my jobdefs for the jobs that might fail
because the VM's (clients) are down:

  RerunFailedLevels = yes
  RescheduleOnError = yes
  RescheduleInterval = 6 hours
  RescheduleTimes = 3
  AllowDuplicateJobs = no
  CancelQueuedDuplicates = yes

The last 2 directives may not be necessary, but it helps prevent bogging
down bareos.  So what this does is re-try error'd jobs 3 times:  Once
after 6 hours, then 12 hours, and then 18 hours after the original
attempt failed.   By the time the 4th re-try would re-occur, we are
already into the next day, so it would be pointless to retry it a 4th time.

You might read about these in the docs to fully understand them. BTW,
I've been using this "recipe" for about 3 years now without problems. 
I'm running bareos 16.2 director and storage daemons, with varying
bareos-fd clients.

Good luck.

Reply all
Reply to author
Forward
0 new messages