[Wylug-discuss] Setting environment variable for service in Debian

David Morris david.morris at 3gtelecoms.net
Thu Oct 22 10:47:55 UTC 2015


I've done a bit of a work around by adding the path into
/usr/local/lib/python2.7/dist-packages/site-packages.pth
Python loads any paths from here on initialisation (as per this
stackscript:
http://superuser.com/questions/247620/how-to-globally-modify-the-default-pythonpath-sys-path
)
It doesn't solve the problem of how to set the environment variables on
services but does solve the problem of freeswitch finding the python path
for my scripts.

On 22 October 2015 at 11:44, Graham Whaley <graham.whaley at gmail.com> wrote:

> Nothing is springing to mind. That leads me to a new question though
> .... how does one debug startup scripts?
> My natural feeling is to litter them with 'echo' (for 'set +x') and
> hope it comes out in a log somewhere, and/or check the man pages to
> see if there is a debug/verbose setting for the daemon etc.
> I'm sure others have some experience here?
>
> That is - you might want to figure out if the script is actually
> pulling in your file or not.
>
>
>  Graham
>
> On 22 October 2015 at 10:58, David Morris <david.morris at 3gtelecoms.net>
> wrote:
> > Thanks Graham,
> >
> > I had found that but it doesn't seem to work. I tried adding
> > PYTHONPATH=mypath
> > export PYTHONPATH=mypath
> >
> > to the /etc/default/freeswitch file (which already existed), but when I
> > restart my service freeswitch it doesn't seem to have the pythonpath set.
> > The settings file already is included from the init.d/freeswitch script
> > using "[ -r /etc/default/$NAME ] && . /etc/default/$NAME"
> > If I quit the service, set my shell PYTHONPATH and then run freeswitch
> in my
> > shell (not as a service) then it does have the variable set correctly.
> > Any idea?
> >
> > Thanks,
> >
> > David
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.lug.org.uk/pipermail/wylug-discuss/attachments/20151022/bad320fc/attachment.html>


More information about the Wylug-discuss mailing list