AFP548 Changing the world one server at a time.

StartupItems and environment variables

Home › Forums › OS X Server and Client Discussion › Questions and Answers › StartupItems and environment variables

Viewing 1 post (of 1 total)
  • Author
    Posts
  • #366355
    probert
    Participant

    Hi,

    I’m trying to launch OpenOffice.org when our server boots. So I created a StartupItem that will launch OOo and Xvfb (OOo needs a X-Server even when it is launched as headless). I also added a DISPLAY environment variable in the script, but when the script is launched, only Xvfb start. It seems that the problem is that OOo don’t see the DISPLAY variable and don’t launch since it can’t find the display name.

    The script is like this :

    #!/bin/sh

    . /etc/rc.common

    StartService ()
    {
    if [ -f “/usr/X11R6/bin/Xvfb” ]; then
    ConsoleMessage “Starting Xvfb”
    /usr/X11R6/bin/Xvfb :1 -screen 0 800x600x8 &
    export DISPLAY=:1
    fi
    sleep 5

    if [ -f “/Applications/OpenOffice.org\ 2.0.app/Contents/MacOS/program/soffice” ]; then
    ConsoleMessage “Starting OpenOffice”
    /Applications/OpenOffice.org\ 2.0.app/Contents/MacOS/program/soffice “-accept=socket,host=localhost,port=8100;urp” -headless -display:1 &
    fi
    }

    DISPLAY=:1; export DISPLAY
    RunService “$1”

    Do I need to do something special so that environment variable can be set and see ? We are still on 10.3.9, so I cannot use launchd.

Viewing 1 post (of 1 total)
  • You must be logged in to reply to this topic.