SearchFAQMemberlist Log in
Reply to topic Page 1 of 1
Variable in Bacula job.
Author Message
Post Variable in Bacula job. 
Hi All,

I am running a notification script before and after a Job begins and ends.

In my Job section, what is the variable to use so that i can pass the client name to the script.

job {
Name = "RazorFishDailyBackup"
Enabled = yes
Type = Backup
Client = RazorFish
FileSet = "RazorFishFileSet"
Schedule = "WeeklyCycle"
Write Bootstrap = "/var/lib/bacula/razorfish.bsr"
Pool = DailySet
Full Backup Pool = DailySet
Differential Backup Pool = DailySet
SpoolData = yes
Storage = AutoLoader
Priority = 9
SpoolData = yes
Messages = Daemon
RunBeforeJob = "/etc/bacula/scripts/notify/notify.sh RazorFishDaily"
RunAfterJob = "/etc/bacula/scripts/notify/notify.sh RazorFishDaily"
}


RunBeforeJob = "/etc/bacula/scripts/notify/notify.sh ServerName"

With what variable should I replace ServerName with? As %C or %c does not work

If you have come across this setup, please point me to the correct documentation.


--
Blue Barracuda Prashant Ramhit is the Systems Administrator at

Blue Barracuda UK
t: +44 (0)20 7400 0950
Sweeps Building,
34 Leather Lane,
London,
EC1N 7SQ
www.bluebarracuda.com

Post Variable in Bacula job. 
On 7/9/2010 5:00 PM, Prashant Ramhit wrote:
Hi All,

I am running a notification script before and after a Job begins and ends.

In my Job section, what is the variable to use so that i can pass the
client name to the script.

job {
Name = "RazorFishDailyBackup"
Enabled = yes
Type = Backup
Client = RazorFish
FileSet = "RazorFishFileSet"
Schedule = "WeeklyCycle"
Write Bootstrap = "/var/lib/bacula/razorfish.bsr"
Pool = DailySet
Full Backup Pool = DailySet
Differential Backup Pool = DailySet
SpoolData = yes
Storage = AutoLoader
Priority = 9
SpoolData = yes
Messages = Daemon
RunBeforeJob = "/etc/bacula/scripts/notify/notify.sh RazorFishDaily"
RunAfterJob = "/etc/bacula/scripts/notify/notify.sh RazorFishDaily"
}


RunBeforeJob = "/etc/bacula/scripts/notify/notify.sh *ServerName*"

With what variable should I replace ServerName with? As %C or %c does
not work

If you have come across this setup, please point me to the correct
documentation.

according to
http://www.bacula.org/5.0.x-manuals/en/main/main/Configuring_Director.html
it should work.

Look for "Before submitting the specified command"

%c = Client's name

works here:

09-Jul 23:35 bacula-dir JobId 36703: shell command: run BeforeJob
"/home/bacula/testing.sh latens-fd"
09-Jul 23:35 bacula-dir JobId 36703: BeforeJob: /home/bacula/testing.sh:
!/bin/sh: not found
09-Jul 23:35 bacula-dir JobId 36703: BeforeJob: hello
09-Jul 23:35 bacula-dir JobId 36703: BeforeJob: latens-fd
09-Jul 23:35 bacula-dir JobId 36703: BeforeJob:

Ignoring the error.... above

But here's my job:

Job {
Name = "testing"
JobDefs = "DefaultJobRemote"
Schedule = "WeeklyCyclePST"
Client = "latens-fd"
FileSet = "basic backup"
Storage = MegaFile-latens
Pool = MegaFile-latens
Write Bootstrap = "/home/bacula/working/latens-fd-basic.bsr"
RunBeforeJob = "/home/bacula/testing.sh %c"
}


And here's the script:
!/bin/sh
echo 'hello'
echo $1
echo $2




That first line should be #!/bin/sh

So.. .what are you doing differently?




--
Dan Langille - http://langille.org/

------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
Bacula-users mailing list
Bacula-users < at > lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Display posts from previous:
Reply to topic Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
  


Magic SEO URL for phpBB