How to setup Mas200 Client Server on Fedora Redhat Core 6

To Install Mas200 Client Server host (Host.exe)  on Linux 
(Should work on any linux system) so that it starts as a service.

Load linux

(Install vnc and samba during install. I also recommend installing developement 
and legacy development environments as a general rule)

Turn off SELinux (Edit /etc/selinux/config and set SELINUX=disabled)

Restart linux so that SELinux is no longer running

We will be installing and running as root. This would probably work fine as a non-root user.

We will be running this headless (No need for XWindows server to be running), by using VNCServer

------------------------------------------------------
To stop xwindows from automatically starting edit /etc/inittab
change 
id:5:initdefault:
to 
id:3:initdefault:

save

Next time you restart linux, it will be in text mode
To enter graphics mode, 
log in as root
Type:
startx

When you log out, XWindows will shut itself down again
------------------------------------------------------


Log in as root

If you didn't install vnc then install it now 
(yum install vnc   If this only installs the viewer then do  yum install vnc-server as well).

install wine (yum install wine)

Setup samba (I recommend using swat)
yum install samba-swat
edit /etc/init.d/swat

remove only_from = 127.0.0.1
set disable = no

restart xinet
kill -HUP `ps -egrep inet|awk '{print $1}'`

with a web browser go to this machines ipAddress:901
ie: http://127.0.0.1:901
enter root as the user, and your password
Set up samba
At least check the netbios name, and create a public share. 

I recommend setting Load Printers to No
unless you want the system to list all of the shared printers on your network

I created a the following directory at a terminal prompt
mkdir /home/public
chmod a+rwx /home/public

I created a share called public
Path /home/public
Read Only No
Create Mask 0666
Directory Mask 0777
Guest Ok Yes   (Only if you want people to have access without being logged in)
Browseable Yes
Available Yes


Restart Samba server on the status screen

I did not try running the MAS90 Server setup program. It was installed on another server
so I copied it on to this server. You can try the setup program using wine (wine /mnt/cdrom/setup)

Copy Mas90 Server directory from a computer to this computer 
Ex: Create a  /home/public directory and share it.
Then copy mas90 server directory to it from old server.
The 90wres32.dll may exist in the mas90/system/system directory. 
If it doesn't, copy it from c:\[windows/winnt]\system32\902res32.dll 
to the mas90 directory so that you can later copy it to /root/.wine/drive_c/windows/system32

As root, run winecfg so that the /root/.wine directory is created

Copy the Mas90 90wres32.dll file to /root/.wine/drive_c/windows/system32

Create a link for mas90 into drive_c
ln -s /home/public/mas90 /root/.wine/drive_c/mas90

type in vncserver so that you can create a password
vncserver

kill server
vncserver -kill :1

Setup vncserver so that it will auto start as follows
edit /etc/sysconfig/vncservers
add the following entries
VNCSERVERS="1:root"
VNCSERVERS[1]="-geometry 1024x768"
save file

edit /root/.vnc/xstartup
unrem the following lines
[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources

save file

Create the mas90host file listed at the end of this page or grab it from www.accountingenhancements.com/filetree/mas90host
and save it to /etc/init.d

create startup entries so that mas90 starts and stops on it's own
chkservice --level 2345 mas90host on
chkservice --level 6 mas90host off

You are done.

You can start the service

service mas90host start

And connect to this machine with vncviewer
vncviewer 127.0.0.1:1

Note: If connecting through vnc from a windows machine, this vncserver 
is not running on the default :0 window. It is running on window 1
so add :1 to the end of the ip address.

Lee Lofgren
Accounting Enhancements, Inc

vi /etc/init.d/mas90host

#!/bin/bash
#
# chkconfig: - 92 34
# description: Starts and stops mas90 host.exe. \
#              used to provide host side support for Mas90 Client Server. \
#              wine must be loaded, with 90WRES32.DLL copied into the \
#              drive_c/windows/system32 directory. vncserver must be setup. \
#              service vncserver start must work. Mas90 home directory \
#              is expected in drive_c/mas90 directory.

# Source function library.
. /etc/init.d/functions

# Source networking configuration.
. /etc/sysconfig/network

user=root

wine=/usr/bin/wine

mas90path="c:/mas90/home/"
mas90="host.exe"
mas90port="10000"

# Check that networking is up.
[ ${NETWORKING} = "no" ] && exit 0

prog=$"Mas90 Host"

vncchannel=`ps --no-heading -fC Xvnc|awk '{print $9}'|awk -F : '{print $2}'`
if [ "$vncchannel" = "" ];
then
        /sbin/service vncserver start
fi
vncchannel=`ps --no-heading -fC Xvnc|awk '{print $9}'|awk -F : '{print $2}'`
if [ "$vncchannel" = "" ];
then
        failure $"$prog Failure: vnc server not running"
        exit 1
fi

DISPLAY=:$vncchannel.0
export DISPLAY
procs=`ps --no-header -fC"$mas90"|grep $mas90port|head -1`

start() {
    echo -n $"Starting $prog: "
    if [ "$procs" != "" ];
    then
       echo $"$prog Already running"
       success $"$prog Already running"
    else
        RETVAL=0
            sleep 10
            runuser -l $user -c "$wine $mas90path$mas90 $mas90port &" >/dev/null 2>/dev/null
            RETVAL=$?
            [ "$RETVAL" -eq 0 ] && success $"$prog startup" || \
                failure $"$prog start"
    fi
    echo
}

stop() {
    echo -n $"Shutting down $prog: "
    if [ "$procs" != "" ] ; then
        kill `ps --noheader -fC"$mas90"|grep $mas90port|awk '{print $2}'`
        success $"$prog shutdown"
    else
        failure $"$prog shutdown"
    fi
    echo
}

# See how we were called.
case "$1" in
  start)
        start
        ;;
  stop)
        stop
        ;;
  restart|reload)
        stop
        sleep 3
        start
        ;;
  status)
        status host.exe
        ;;
  *)
        echo $"Usage: $0 {start|stop|restart|status}"
        exit 1
esac

save file