I am starting to get into a few special circumstances that I need to have a service stopped before I can back it up I am receiving the errors below. I have established a Bacula sudoers file that should allow for things, but still run
into the permission denied see information below.
Thank you in advance.
# cat /etc/sudoers.d/bacula
bacula ALL=NOPASSWD: /usr/bin/systemctl.
# cat /etc/bacula/bacula-dir.conf
<snip>
Job {
Name = "D2D-MyService-Application"
Client = myservice-fd
JobDefs = "2Disk Full Jobs"
Pool = Daily_Disk
FileSet = "MyService-Application"
Schedule = "Days-MTWHFSU"
Write Bootstrap = "/backup/bacula/spool/%n.bsr"
Priority = 6
RunScript {
Command = “/usr/bin/sudo /usr/bin/systemctl start myservice"
RunsWhen = After
RunsOnClient = yes
}
RunScript {
Command = "/usr/bin/sudo /usr/bin/systemctl stop myservice "
RunsWhen = Before
RunsOnClient = yes
}
}
<snip>
# Relevant Job error output
27-Apr 18:53 bacula-dir JobId 79: Start Backup JobId 79, Job=D2D-MyService-Application.2017-04-27_18.52.58_08
27-Apr 18:53 bacula-dir JobId 79: Using Device "FileChgr1-Dev1" to write.
27-Apr 18:53 myservice-fd JobId 79: shell command: run ClientBeforeJob "/usr/bin/sudo /usr/bin/systemctl stop myservice"
27-Apr 18:53 myservice-fd JobId 79: Error: Runscript: ClientBeforeJob returned non-zero status=200. ERR=Permission denied 27-Apr 18:53 bacula-dir JobId 79: Fatal error: Bad response to RunBeforeNow command: wanted 2000 OK RunBeforeNow
, got 2905 Bad RunBeforeNow command.
27-Apr 18:53 bacula-dir JobId 79: Fatal error: Client " myservice-fd" RunScript failed.
27-Apr 18:53 bacula-dir JobId 79: Error: Bacula bacula-dir 7.4.7 (16Mar17):
Jim Richardson