How to execute a Script after and before job?

1,895 views
Skip to first unread message

Goncalo Sousa

unread,
Mar 6, 2020, 10:52:26 AM3/6/20
to bareos-users
So as far as I know I add the option: RunAfterJob=yes and RunBeforeJob=yes in bareos-dir.d/job but how do I call the script?


Andrei Brezan

unread,
Mar 6, 2020, 11:32:46 AM3/6/20
to bareos-users
You need to put the script as the value:

RunBeforeJob="/path/to/my/script"

Goncalo Sousa

unread,
Mar 9, 2020, 8:19:31 AM3/9/20
to bareos-users
And how do I set to execute the script on the client?

For example: The script is located on the client and I want to execute it from it?

Andrei Brezan

unread,
Mar 9, 2020, 8:26:02 AM3/9/20
to bareos-users
Just look at the documentation: https://docs.bareos.org/Configuration/Director.html#job-resource
You can have Client Run Before Job and Client Run After Job.

--
Andrei

Goncalo Sousa

unread,
Mar 9, 2020, 8:38:58 AM3/9/20
to bareos-users
Basically edit /etc/bareos/bareos-dir.d/job/server.conf and add 'ClientRunBeforeJob=/path/to/script/in/client' is this it?

Goncalo Sousa

unread,
Mar 9, 2020, 11:06:01 AM3/9/20
to bareos-users
I configured this way on /etc/bareos/bareos-dir.d/job/server.conf

Job {
  Name = "server-job"
  Client = server-fd
  Type = Backup
  Level = Incremental
  FileSet = "server-fs"
  Schedule = "schedule"
  Storage = server-sd
  Messages = Standard
  Pool = pool-server
  Priority = 10
  Write Bootstrap = "/var/lib/bareos/%c.bsr"
  Client Run Before Job = /root/pre_backup.sh
  Client Run After Job = /root/pre_backup.sh
}

The script is located in the client side. It is giving me the following errors:

server-fd JobId 3954: shell command: run ClientBeforeJob "/root/pre_backup.sh"
server-fd JobId 3954: ClientBeforeJob: the input device is not a TTY
server-fd JobId 3954: Error: Runscript: ClientBeforeJob returned non-zero status=1. ERR=Child exited with code 1
bareos-dir JobId 3954: Start Backup JobId 3954, Job=server-job.2020-03-09_14.56.25_04
bareos-dir JobId 3954: Using Device "server-sd" to write.
bareos-dir JobId 3954: Fatal error: Bad response to RunBeforeNow command: wanted 2000 OK RunBeforeNow, got 2905 Failed RunScript
bareos-dir JobId 3954: Fatal error: Client "server-fd" RunScript failed

segunda-feira, 9 de Março de 2020 às 12:26:02 UTC, Andrei Brezan escreveu:

Marcio Feldmann

unread,
May 29, 2024, 9:26:01 PM5/29/24
to bareos-users
Hi Goncalo, I saw you had an error "RunBeforeNow, got 2905 Failed RunScript" from the RunBeforeNow script. Did you manage to solve it out? I know it has more than 4 years, but I just faced the same issue with the latest Bareos Version.
Thanks in Advance!

----
Oi Goncalo, vi que você teve o erro "RunBeforeNow, got 2905 Failed RunScript" no script que roda antes do Job de Backup. Você por acaso conseguiu identificar e consertar esse problema? Tive exatamente esse problema em um job no Bareos que estou rodando na última versão, porém não encontrei muitas referencias a isso na Internet.
Abraços!

Best,
Marcio Feldmann

Reply all
Reply to author
Forward
0 new messages