Problem
Merge documentation has examples of starting DOS with cron.
When that is attempted with DOS applications that require a
graphical screen, or if a MicroSoft Windows application is run
with cron, this error occurs: ed:INIT_FAIL:dos:ERROR:Could not initialize device 'stdin/stdout' Cause
Cron attempted to start Merge DOS or Windows and could not acquire a particular port or terminal control routines for a Merge DOS/Windows session.
In order to start SCO Merge, it is necessary to own the tty port; cron cannot assign tty ports.
The error message is prompted when Merge fails to determine the tty port, and hence the command fails.
Solution
Use the following steps to create and implement a pseudo initstate, then use "init" to start a DOS or Windows session that will be run by "root" on /dev/tty05, the fifth multiscreen on the console.
1. In this example, tty05 will be used to display a DOS or Windows session run by cron. That tty will need to be disabled with the following command:
# disable tty05This will disable the getty login on the fifth multiscreen.
Then add the following lines at the end of /etc/inittab and /etc/conf/cf.d/init.base:
dos:a:once:/etc/startdos </dev/tty05> /dev/tty05 2>&1
win:b:once:/etc/startwin </dev/tty05> /dev/tty05 2>&1
chg:ab:once:/etc/change </dev/tty05> /dev/tty05 2>&1The "dos" line identifies pseudo initstate "a", the "win" line identifies pseudo initstate "b", and the "chg" line identifies action that is taken if the initstate is either a or b.
NOTE: Additions or changes to /etc/conf/cf.d/init.base will be
used during kernel link by link_unix and idmkinit to create a
new /etc/inittab.2. Create two scripts, "/etc/startdos" and "/etc/startwin" to give
instructions on starting DOS or windows. Examples below:#!/bin/sh
# startdos
TERM=ansi
export TERM
/bin/su root -c /bin/dos </dev/tty05> /dev/tty05 2>&1#!/bin/sh
# startwin
TERM=ansi
export TERM
/bin/su root -c /bin/win </dev/tty05> /dev/tty05 2>&1NOTE: These example scripts use "tty05" and root user, any other multiscreen up to tty12 may be used and any other user that can run DOS and Windows can be used.
3. Create a third script, "/etc/change" to change the console display to tty05, so that DOS and especially Windows will have its display initialized:
#!/bin/sh
# change
TERM=ansi
export TERM
/bin/echo "\033[04z\n"NOTE: "\033[04z\n" is the ansi escape sequence to change the
display to the second virtual terminal "tty05".4. Run "init q" as root to have "init" re-read /etc/inittab or simply reboot the system in multiuser mode.
To have cron start a DOS or Windows application, simply modify the "startdos" or "startwin" script.
As an example, to start the Windows "clock", edit the following line in the "startwin" script with the following additions:
/bin/su root -c "/usr/bin/win clock" </dev/tty05> /dev/tty05 2>&1As an example, to start DOS "dir", edit the following line in the "startdos" script with the following additions:
/bin/su root -c "/usr/bin/dos dir" </dev/tty05> /dev/tty05 2>&1In the above examples "clock" and "dir" are in the path for the DOS or Windows session. Ensure that any DOS or Windows command that is attempted to run with this script is included in the path statement for DOS and/or Windows.
NOTE: DOS and Windows will not normally exit or quit without a
command to do so, this behavior may depend on whether or not the
application requires input to continue, or can just run by itself
to completion and exit the session. The user or administrator
will need to configure the DOS or Windows cron session for the
behavior desired.NOTE: After init has re-read /etc/inittab, the above steps can be
tested with "at", as in the example below, to start DOS and the
desired application entered in /etc/startdos:# at now +2 minutes
init a
^dIn two minutes dos and desired application will start on "tty05".
See also
man (F) inittab, man (M) init, man (MERGE) dos, man (C) su, man (ADM) idmkinit, man (ADM) link_unix, SCO Merge User's Guide