View Issue Details

IDProjectCategoryView StatusLast Update
0000419bareos-coredirectorpublic2023-09-05 16:01
Reporterstephand Assigned Tobruno-at-bareos  
PrioritylowSeverityfeatureReproducibilityalways
Status closedResolutionfixed 
Product Version14.2.2 
Summary0000419: admin job does not run script on client
DescriptionWhen using an admin job (a job with Type = Admin) that defines a RunScript with RunsOnClient = yes is not executed.
Steps To ReproduceDefine an admin job with the following parameters:

Job {
  Name = TestAdminJobOnClient
  JobDefs = DefaultJob
  Type = Admin
  Priority = 40

  RunScript {
    RunsWhen = Before
    RunsOnClient = yes
    Fail Job On Error = yes
    Command = "/usr/local/bin/bareos_test_adminjob.sh"
  }
}

The script /usr/local/bin/bareos_test_adminjob.sh:
#!/bin/bash
echo "$(date) bareos_test_adminjob started" >> /tmp/bareos_test_adminjob.log
echo "id: $(id)"
echo "whoami: $(whoami)"
echo "pwd: $(pwd)"
echo -e "output line 1\noutput line 2\noutput line 3"
echo "exiting with exit 1"
echo "$(date) bareos_test_adminjob exiting with exit 1" >> /tmp/bareos_test_adminjob.log
exit 1

Acutal result when running the job:

[root@bareost01 ~]# bconsole
Connecting to Director bareost01:9101
1000 OK: bareost01-dir Version: 14.2.2 (12 December 2014)
Enter a period to cancel a command.
*run job=TestAdminJobOnClient
Using Catalog "MyCatalog"
Run Admin Job
JobName: TestAdminJobOnClient
FileSet: Full Set
Client: bareost01-fd
Storage: File
When: 2015-02-01 13:13:58
Priority: 40
OK to run? (yes/mod/no): yes
Job queued. JobId=263
*
You have messages.
*mes
01-Feb 13:14 bareost01-dir JobId 263: Start Admin JobId 263, Job=TestAdminJobOnClient.2015-02-01_13.14.00_04
01-Feb 13:14 bareost01-dir JobId 263: BAREOS 14.2.2 (12Dec14): 01-Feb-2015 13:14:02
  JobId: 263
  Job: TestAdminJobOnClient.2015-02-01_13.14.00_04
  Scheduled time: 01-Feb-2015 13:13:58
  Start time: 01-Feb-2015 13:14:02
  End time: 01-Feb-2015 13:14:02
  Termination: Admin OK

Expected result:
The output of the script should be in the job messages and
the nonzero exit code should have lead to termination with error.
Additional InformationAttached bareos-dir debug at level 200

Running bareos-fd with debug level 200 at the same time does not show any output when running the admin job.

Note: works as expected when running the same script within a normal backup job:
FileSet {
  Name = "EmptyDirSet"
  Include {
    Options {
      signature = MD5
    }
    File = "/data/emptydir"
  }
}

Job {
  Name = TestJobWithScriptOnClient
  JobDefs = DefaultJob
  Type = Backup
  FileSet = EmptyDirSet
  Priority = 40

  RunScript {
    RunsWhen = Before
    RunsOnClient = yes
    Fail Job On Error = yes
    Command = "/usr/local/bin/bareos_test_adminjob.sh"
  }
}
TagsNo tags attached.

Activities

stephand

stephand

2015-02-01 13:48

developer  

tigerfoot

tigerfoot

2016-08-25 11:55

developer   ~0002339

Last edited: 2016-08-25 11:57

Still true with 15.2 version
But work with Run On Client = no
?

joergs

joergs

2019-12-03 12:58

developer   ~0003644

The behavior has not changed. However, Pull Request https://github.com/bareos/bareos/pull/359 would at least produce a hint in the Job Message.
bruno-at-bareos

bruno-at-bareos

2023-09-05 16:01

manager   ~0005378

no admin job will run on client

Issue History

Date Modified Username Field Change
2015-02-01 13:48 stephand New Issue
2015-02-01 13:48 stephand File Added: bareos-dir_debug_TestAdminJobOnClient.out
2015-02-01 14:20 mvwieringen Severity minor => feature
2015-11-06 18:02 maik Status new => acknowledged
2016-08-25 11:55 tigerfoot Note Added: 0002339
2016-08-25 11:56 tigerfoot Note Edited: 0002339
2016-08-25 11:57 tigerfoot Note Edited: 0002339
2019-12-03 12:58 joergs Note Added: 0003644
2023-09-05 16:01 bruno-at-bareos Assigned To => bruno-at-bareos
2023-09-05 16:01 bruno-at-bareos Status acknowledged => closed
2023-09-05 16:01 bruno-at-bareos Resolution open => fixed
2023-09-05 16:01 bruno-at-bareos Note Added: 0005378