application doesnt start at startup when run via WINE !

Open forum for end-user questions about Wine. Before asking questions, check out the Wiki as a first step.
Forum Rules
Locked
noble_curious
Level 1
Level 1
Posts: 5
Joined: Thu May 15, 2008 5:48 am

application doesnt start at startup when run via WINE !

Post by noble_curious »

:evil:
Hi all,

I am using Fedora 8 Linux.

I have a situation where i need to start a service at startup. the service is started using wine say... ` wine MyService.exe`
I made a small daemon script for it which has start and stop functions where start function just runs above statement. Then I have configured this script to start at runlevel 5. Now the situation is that at startup there is no sign of my service being started. To verify if the service script is OK.. I run this script at shell
service MyService start
where MyService is the script under init.d directory. But nothing happened
But strage thing is that when I run script like this:
/etc/init.d/MyService start
or
/etc/rc.d/init.d/MyService start
That works and my service is started!

I was suspicious if there is something wrong with my MyService.exe application so I changed the MyService script start function as
start()
{
wine notepad &
}
and the same thing happened!. While running service using service command it doesnt starts notepad while if I provide full path of the service script it then started notepad. What is the problem here. I then creaated another small application as native Linux which was small server started to accept clients. This application was successfully started both with service command and by providing full path to the script. But when I compile same application program code in Windows and run it via WINE it doesnt start using service command. You people may check this at your system by testing if above listed start function runs successfully or not! using service command. I guess that while system boots and process through various runlevel it starts/stops services using service command and this is the reason it doesn't start at startup.
I tried to have one trick as well. I put another function with the name start2()

it was like this
..
...

start2(){
wine notepad &
}

start(){
/etc/init.d/MyService start2
}
...
.....
But this too was void. As it didnt work. Now one thing is obvious that there is problem due to wine here.

Please share your experience and help me out that how can I use wine to start windows application at startup. Kindly look into the matter

Regards,
noble_curious
noble_curious
Level 1
Level 1
Posts: 5
Joined: Thu May 15, 2008 5:48 am

Post by noble_curious »

Have I asked irrelevent question? :(
Tlarhices
Level 4
Level 4
Posts: 101
Joined: Sun Mar 02, 2008 9:28 pm

Post by Tlarhices »

noble_curious wrote:Have I asked irrelevent question? :(
I think there are not much people around here trying to do this kind of thing.
I have never tried by myself so what I will say might be wrong but I can't let you alone.

You can't run wine if there is no X server around (where will the window of notepad open ?). And that windows command line often use part of the API that need a graphical environment.
By using init.d you are trying to start wine before a graphical session is started.

The best would be to start your script at session login (in Preferences -> Session for Gnome) so everything will be ready.

But it needs your user to log in before the service starts.
noble_curious
Level 1
Level 1
Posts: 5
Joined: Thu May 15, 2008 5:48 am

Post by noble_curious »

But when user logins even then service even doesnt start manually either by

starting the service through service configuration window

or by writing this statement

service MyService start

but it does work by writing this statement

/etc/init.d./MyService start

My assumption is that there is some compatibility issue between WINE and service command ...
vitamin
Moderator
Moderator
Posts: 6605
Joined: Sat Feb 23, 2008 2:29 pm

Re: application doesnt start at startup when run via WINE !

Post by vitamin »

noble_curious wrote:. Now the situation is that at startup there is no sign of my service being started. To verify if the service script is OK.. I run this script at shell
service MyService start
where MyService is the script under init.d directory. But nothing happened
But strage thing is that when I run script like this:
/etc/init.d/MyService start
or
/etc/rc.d/init.d/MyService start
That works and my service is started!
Look at the source of the"service" script. Wine in 99% cases requires valid X session to operate. Which means DISPLAY env var have to be set. If the "service" script clears environment with say "env" then that's your answer.
felix
Level 2
Level 2
Posts: 45
Joined: Thu Feb 28, 2008 10:04 am

application doesnt start at startup when run via WINE !

Post by felix »

On Fri, Oct 10, 2008 at 12:30:52AM -0500, noble_curious wrote:
Have I asked irrelevent question? :(
You need to look more closely at how services are run by linux.

1) Services started by the init process are run as the root user, which
you should no use for running wine apps, so you need to look at having
the service start wine+program as a different user.

2) Running '/etc/init.d/MyService start' as a normal user with a
graphical interface running, is not the same as running it as a service
that gets started at system boot-up.

3) wine normally requires use of X as mentioned by other people, which
means that it will fail to run if the desktop is not up yet. Also you
shouldn't run a process that requires X as a service.

Basically services in linux are completely background and do not require
a desktop, services in windows generally rely on the explorer process to
be running, which requires a graphical desktop. It is only since windows
server 2008 that this has changed.


Perhaps what you really want to is start a wine instance with that
program on login? Gnome/KDE can be configured to execute scripts on
login which might give you what you really want.

--
Darragh

"Nothing is foolproof to a sufficiently talented fool."
Gert van den Berg

application doesnt start at startup when run via WINE !

Post by Gert van den Berg »

On Fri, Oct 10, 2008 at 4:17 PM, Darragh Bailey
<[email protected]> wrote:
On Fri, Oct 10, 2008 at 12:30:52AM -0500, noble_curious wrote:
Have I asked irrelevent question? :(
You need to look more closely at how services are run by linux.
<snip>
3) wine normally requires use of X as mentioned by other people, which
means that it will fail to run if the desktop is not up yet. Also you
shouldn't run a process that requires X as a service.

Basically services in linux are completely background and do not require
a desktop, services in windows generally rely on the explorer process to
be running, which requires a graphical desktop. It is only since windows
server 2008 that this has changed.
Services, as in the things managed by services.msc need specific
permission to interact with the desktop and, if required by another
service (and startup mode is manual), or the startup mode is
automatic, are loaded after bootup and before login, typically running
under an account such as SYSTEM, LOCAL SERVICE and NETWORK SERVICE
(IIRC in decreasing order of permissions)

Explorer is only started after login..

http://support.microsoft.com/kb/327618
http://en.wikipedia.org/wiki/Windows_service
Perhaps what you really want to is start a wine instance with that
program on login? Gnome/KDE can be configured to execute scripts on
login which might give you what you really want.

--
Darragh

"Nothing is foolproof to a sufficiently talented fool."
Locked