Run Job not executed on Client

34 views
Skip to first unread message

Kai Zimmer

unread,
Jun 10, 2022, 5:30:30 AM6/10/22
to bareos-users
Hi,

i'm stuck trying to get a "run job" executed on a bareos client. I tried
"Run Script", "ClientRunBeforeJob" and "Client Run Before Job" with the
same result - no execution.
Bareos-dir (server) version 19.2.7-2 on Debian Bullseye
Bareos-fd (client) version 19.2.7.-2 on Ubuntu 20.04.1
The logfile (setdebug level=100 enabled) doesn't even mention "runscript".

The job definition looks like this:
Job {
  Name = "KiraDstarSources"
  JobDefs = "KiraDstarSourcesJob"
  Client = "kira-fd"
  Run Script {
     Command = "bash -c 'touch /tmp/bareos_dstar_sources.tmp'"
     Runs On Client = Yes
     Runs When = Before
  }
}

When i switch "Runs On Client" to "No" (so it runs on the serverside),
the job is properly executed:
locutus-dir (50): dird/jobq.cc:907-0 Inc Job=KiraDstarSources rncj=1
locutus-dir (100): cats/sql_query.cc:131-437 called: bool
BareosDb::SqlQuery(const char*, int) with query UPDATE Job SET
JobStatus='R',Level='F',StartTime='2022-06-10
11:02:01',ClientId=31,JobTDate=1654851721,PoolId=5,FileSetId=71 WHERE
JobId=437
locutus-dir (100): lib/runscript.cc:228-437 runscript: running a
RunScript object type=124
locutus-dir (100): lib/runscript.cc:236-437 runscript: running 'bash -c
'touch /tmp/bareos_dstar_sources.tmp''...
locutus-dir (100): cats/sql_query.cc:131-437 called: bool
BareosDb::SqlQuery(const char*, int) with query INSERT INTO Log (JobId,
Time, LogText) VALUES (437,'2022-06-10 11:02:01','locutus-dir JobId 437:
shell command: run BeforeJob "bash -c ''touch
/tmp/bareos_dstar_sources.tmp''"
')
locutus-dir (100): lib/runscript.cc:267-437 runscript OK

Any hints what might be the problem?

Best regards,
Kai

Kai Zimmer

unread,
Jun 10, 2022, 6:34:45 AM6/10/22
to bareos-users
Hi again,

so my idea was to generate a file list to backup before the job starts
to run. Bareos stopped the job because the file list didn't exist yet
when the job was started. I probably interpreted "ClientRunBeforeJob"
wrong or so.

Best regards,
Kai

Andrew Feldmann

unread,
Jun 10, 2022, 7:56:04 AM6/10/22
to Kai Zimmer, bareos-users
Hi,

You might try turning on logging on the client.  But also, try providing
the full path the the commands,

ie "/bin/bash -c /usr/bin/touch /tmp/bareos_dstar_sources.tmp"

I hope that helps,

Andrew

Spadajspadaj

unread,
Jun 10, 2022, 9:16:27 AM6/10/22
to bareos...@googlegroups.com
If you want a dynamic list of files, why don't you use the dynamic list
functionality? :-)

https://docs.bareos.org/Configuration/Director.html#id11

Kai Zimmer

unread,
Jun 10, 2022, 10:31:49 AM6/10/22
to bareos...@googlegroups.com
Thanks for the hint. That's what i tried in the first place, but without
luck - my job just returned "Errors=1". So i tried to simplify.
So far i cannot tell whether i'm successful or not, it will take a while
to test.

Spadajspadaj

unread,
Jun 10, 2022, 10:44:52 AM6/10/22
to bareos...@googlegroups.com
I used this several times.

Sample from one of my installations (in this case bareos was used as an
archiving solution):

FileSet {
    Name = "Local-offline-archives"
    Include {
        File = "\\| find /srv/archive -type f -not -path '*backup*'
-ctime +365"
Reply all
Reply to author
Forward
0 new messages