Hi Dave,

On 3/6/2006 6:25 PM, Dave Dmytriw - NetCetera wrote:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Hi,

I currently maintain a number of small bacula installations for
organizations that only use a single tape drive and do full backups
every week night.  One issue that cause some grief is holidays - there
is no one around to change the tape and the situation is not handled as
elegantly as I would like.

I did some research and stumbled upon the following python script that
does exactly what I want: the script checks a text file with a simple
holiday schedule entered in a month/day format and will return 0 or 1
upon execution.

http://www.biostat.wisc.edu/~annis/creations/period.py.html

I tried a simple RunBeforeJob with the script itself - after fudging the
holiday file to make today look like a holiday.  The script returned a 1
- - as it should - but the job continued running.  I thought that if a 0
is not returned from a script then the director would abort executing
the job - exactly what I want for my single tape drive environment.

More important than the text returned is the status code the script exits with.

Try using sys.exit(1) instead of simply writing the "1" and things should work... at least, using a bash script, I can prevent jobs from running.

Here is the relevant bits from my bacula-dir.conf:

Job {
  Name = "TESTER"
  Type = Backup
  RunBeforeJob = "/etc/bacula/period.py"

That script would be very useful to see...

  Client = testlet-fd
  FileSet = "Full Set"
  Schedule = "WeeklyCycle"
  Storage = DDS-3
  Messages = Standard
  Pool = Default
  Write Bootstrap = "/var/bacula/NightlySave.bsr"
  Max Start Delay = 22h
}

and from the log:
06-Mar 09:51 testlet-dir: No prior Full backup Job record found.
06-Mar 09:51 testlet-dir: No prior or suitable Full backup found. Doing
FULL backup.
06-Mar 09:51 testlet-dir: RunBefore: 1

... and here, some message like
"04-Mar 08:20 goblin-dir: DracheStd.2006-03-04_08.20.00 Fatal error: RunBeforeJob error: ERR=Child exited with code 1" should be reported.

06-Mar 09:51 testlet-dir: Start Backup JobId 6,
Job=TESTER.2006-03-06_09.51.28
06-Mar 09:51 testlet-sd: Job TESTER.2006-03-06_09.51.28 waiting. Cannot
find any appendable volumes.
Please use the "label"  command to create a new Volume for:
    Storage:      "DDS-3" (/dev/nst0)
    Media type:   DDS-3
    Pool:         Default

The RunBefore returns a 1 - but the job progresses.

I am sure there is a much more elegant way to integrate this python
script into the new bacula python framework - but i am certainly not the
guy to try that ... :)

Any thoughts on the best way to do this is greatly appreciated.

One simple line of code should be enough... perhaps two, if you also count the "import sys"...

Arno

Dave

- --
Dave Dmytriw
Principal, NetCetera Solutions Inc.
Calgary, AB
403-703-1399
[EMAIL PROTECTED]
http://www.netcetera-solutions.com
"It's about using NetWorks, Etc..."
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.0 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFEDHBwDcivrcMaKcIRAnr0AJ9ZbIB02T01XFPhw2L1vF7gTJb7hACbByjG
3GPxtKRMOk+YlbEZl4dkatY=
=LmaD
-----END PGP SIGNATURE-----



-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users


--
IT-Service Lehmann                    [EMAIL PROTECTED]
Arno Lehmann                  http://www.its-lehmann.de


-------------------------------------------------------
This SF.Net email is sponsored by xPML, a groundbreaking scripting language
that extends applications into web and mobile media. Attend the live webcast
and join the prime developer group breaking into this new coding territory!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to