>>>>> On Thu, 6 Sep 2007 20:53:17 -0500, Kelly, Brian said:
> 
> I am running a post job python script that fails because python is unable to
> import some libraries. I am running bacula as root. When running the script
> manually as root there are no problems. Issuing the env command as root
> yields a correct PYTHONPATH variable:
> 
> PYTHONPATH=/usr/lib64/portage/pym:/prod/bacula/local/lib64/python2.4/site-pa
> ckages:/prod/bacula/local/lib/python2.4/site-packages
> 
> I wrote a small test script to determine what the environment variables look
> like when the director fires off a script as follows:
> 
> #!/bin/bash
> echo "++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" >>
> /prod/bacula/var/bacula-environment
> echo "" >> /prod/bacula/var/bacula-environment
> date >> /prod/bacula/var/bacula-environment
> echo "" >> /prod/bacula/var/bacula-environment
> /bin/env >> /prod/bacula/var/bacula-environment
> whoami >> /prod/bacula/var/bacula-environment
> echo "***********************************************************" >>
> /prod/bacula/var/bacula-environment
> 
> This yields the following output:
> 
> ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
> 
> Thu Sep  6 18:30:54 CDT 2007
> 
> SHELL=/bin/bash
> TERM=xterm
> DEFAULTLEVEL=default
> USER=root
> PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/sbin:/usr/local/sbin:/usr/loca
> l/bin:/usr/sbin:/usr/bin:/sbin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/gcc-bi
> n/4.1.2
> PWD=/
> BOOTLEVEL=boot
> CONSOLETYPE=pty
> SVCNAME=bacula
> HOME=/root
> SHLVL=2
> SOFTLEVEL=default
> _=/bin/env
> root
> ***********************************************************
> 
> Can anyone help me to understand why the the PYTHONPATH environment variable
> is missing when the director fires off my simple shell script? I'm not sure
> if I am doing something incorrectly within Bacula or if I've somehow
> configured my Linux distro incorrectly. 
> 
> Thanks in advance for any advice with this problem. If you need more
> information please let me know.
> 
> Brian Kelly

Where do you get PYTHONPATH normally?  I can think of two possibilities:

1. You set it in your own non-root shell init files.  Since Bacula runs the
   script as root, it doesn't read your init files.  When you tested env as
   root, maybe you did this by ``su'' or ``su root'', which would cause your
   environment to be inherited by the root shell.

2. Root sets PYTHONPATH in an init file that is not loaded by bash when
   running a shell script, e.g. .bash_login.

__Martin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Bacula-users mailing list
Bacula-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/bacula-users

Reply via email to