You don't need a real Xserver which is connected to a monitor. For instance you could use Xvnc or whatever. Is there no other way to do what you need? Starting wine and then closing it again is a relative heavy operation if it needs to happen frequently. The first thing I would test is if you really need X. Try to run script without a display variable (e.g. when you are in a terminal outside X) as a normal user.