Can start-stop-daemon use environmental variables?

Posted by scottburton11 on Server Fault See other posts from Server Fault or by scottburton11
Published on 2010-04-01T09:17:17Z Indexed on 2010/04/01 9:23 UTC
Read the original article Hit count: 283

I need to daemonize a Windows app running in Wine, and create a pid in /var/run. Since it requires an X11 session to run, I need to make sure the $DISPLAY variable is set in the running user's environment.

Assuming I already have a X11 session running, with a given display, here's what the start-stop-daemon line looks like in my /etc/init.d script:

start-stop-daemon --start --pidfile /var/run/wine-app.pid -m -c myuser -g mygroup -k 002 --exec /home/myuser/.wine/drive_c/Program\ Files/wine-app.exe

Unfortunately, my version of start-stop-daemon on Ubuntu 8.04 doesn't have the -e option to set environmental variables. I gather that you could simply set $DISPLAY before the command, like so:

VAR1="Value" start-stop-daemon ...

But it doesn't work. Since I'm using the -c {user} option to run as a specific user, I'm guessing there's an environment switch and VAR1 is lost. I've tried exporting DISPLAY from the running user's .profile and/or .bashrc but it doesn't work either.

Is there another way to do this? Is this even possible? Am I overlooking something?

Many thanks

© Server Fault or respective owner

Related posts about pid

Related posts about daemon