[Wine]Running DOS program in a cron job

Holly Bostick motub at planet.nl
Tue Jun 28 09:22:49 CDT 2005


Patrick Naef schreef:
> Hi,
> 
> I'm trying to run a DOS program within a cron job. After much trial-and-error I settled on the following approach:
> 
> - rm -r ~/.wine
> 
> - call wine without any arguments, this lets wine generate a default configuration in ~/.wine
> 
> - change ~/.wine/config: set GraphicsDriver to ttydrv instead of x11drv
> 
> - the cron job consists of a shell script that runs the DOS program with "wcmd /c"
> 
> 
> The whole thing works when I run the shell script interactively, over a non-X11 ssh connection. However, when I run the shell script via cron, wcmd prints the following on stderr:
> 
> Error opening terminal: unknown.
> 
> I have tried setting (and exporting) TERM to a number of devices, among them /dev/null or /dev/tty1, but this didn't help. I have tried chown'ing the device to the user that runs the cron job, again with no success.
> 
> 
> Has someone got an idea what I'm doing wrong? Should I use a different approach? Should I use wineconsole instead of wcmd (how?)?
> 
> Thanks for any help
> Patrick
> 
> Btw: I'm running wine-20050419 on SuSE 9.1. I already tried upgrading to wine-20050524, but this release seems to ignore ttydrv completely...
> 

Hi, Patrick,

I openly admit that I don't know a whole lot about the several subjects
involved in this procedure, so I could be completely wrong, but....

Doesn't the cron job run as a root user (or member of the root group)?
Certainly root owns the cron daemon, afaik.

Afaik, Wine doesn't like this *at all* . It is strongly recommended not
to run Wine as root, and as I currently understand it, Wine doesn't run
at all well under these circumstances, and in fact what did run may have
been intentionally disabled, because running Wine as root is apparently
An Extremely Bad Thing (TM).

Secondly, under these circumstances (cron + ssh + wine + ttydrv + ?),
who owns the terminal device in question? Perhaps here again is an
ownership conflict, as the various handoffs seem quite capable of
dropping the ball somewhere along the line. Or is the cron job meant to
run on the machine you're ssh-ing into rather than on yours, and so no
part of the job is to ssh in? Either way, it's still rather a lot of
device and driver ownership to pass around.

Thirdly, what is the DOS program meant to do? Does it require input, or
just generate output? If the former, does it have any kind of a silent
mode in which it wouldn't need a terminal on which to display at all (in
which case you could perhaps run it with the appropriate switches when
calling it with the cron job)? If the latter, does it have a silent mode
in which it just generates the output (again without appearing), and you
could just pipe the output to be mailed back to you by the cron daemon?

I'm sure that someone who knows more about the issues involved will have
better and more exact ideas, but I'm wondering if the cron job shouldn't
start with root su-ing to the user of the machine first, or if that user
shouldn't be a member of the cron group, so that they can run the job
themselves (as the user, if logged in, will own the tty and the .wine
directory, and the driver, etc, etc).

Hope this is in some way helpful,
Holly



More information about the wine-users mailing list