Re: [Bacula-users] Variable in Bacula job.
2010-07-09 18:40:15
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 DOT net
https://lists.sourceforge.net/lists/listinfo/bacula-users
|
|
|