How to make Wine to shutdown computer?

Questions about Wine on Linux
Locked
fernando_ccs17
Newbie
Newbie
Posts: 2
Joined: Sat Sep 29, 2012 4:52 pm

How to make Wine to shutdown computer?

Post by fernando_ccs17 »

I have a POS software running under Wine. At the end of the day, it asks if you want Shutdown or not the computer.

If I answer "no", the program simply terminates. If you answer "yes", he usually calls the program "shutdown.exe" from Windows.

Obviously, on Wine, answering "yes" has the same effect as "no", because Wine does not have "shutdown.exe" in the system.

Are there any plans to implement this feature in Wine?
Turbine
Level 1
Level 1
Posts: 5
Joined: Sat Sep 29, 2012 7:53 pm

Re: How to make Wine to shutdown computer?

Post by Turbine »

In the past I believe its shutting down just reset the wine bottle. As restarting due to a Window's setup was unnecessary.
fernando_ccs17
Newbie
Newbie
Posts: 2
Joined: Sat Sep 29, 2012 4:52 pm

Re: How to make Wine to shutdown computer?

Post by fernando_ccs17 »

So, there is a workaround for this?

Can i Shutdown my Linux computer from Wine, by a software that calls "shutdown.exe"?
Fred2
Level 2
Level 2
Posts: 45
Joined: Mon Jul 18, 2011 11:58 am

Re: How to make Wine to shutdown computer?

Post by Fred2 »

I'm not sure if programs in Wine should be able to shutdown the computer at all. The equivalent to shutdown.exe is /sbin/shutdown and requires root priviledges.

You can without problem call Linux programs from within Wine (like Z:\usr\bin\gimp).
For shutdown, there are two problems:
a) it requires root (and you can't run Wine as root; also you wouldn't want an admin prompt when the computer is going to shutdown, but much earlier)
b) it requires a time (like "now"), but command line arguments can often cause problems between Windows and Unix notation (one can create a wrapper script like here: http://wiki.winehq.org/FAQ#head-a2e0e85 ... ebfefa7ce4)

Maybe someone else has a better solution, I tried using a Linux script to launch the Windows program and to shutdown after completion:

Code: Select all

wine "C:/Program Files/.../program.exe" && gksudo shutdown now
T.Hollenbeck
Newbie
Newbie
Posts: 1
Joined: Tue Dec 03, 2013 6:36 am

Re: How to make Wine to shutdown computer?

Post by T.Hollenbeck »

Hello

Create in the directory windows under drive c: a linux bash file with the name "shutdown" and the right to run

Code: Select all

#!/bin/sh
/sbin/halt
And you must give normale users the privilege to halt linux
Locked