How to run POS on a Linux box

Make comments, ask questions, or just complain about the software on this site. Or comment on any educational software.
Please note that by clicking on links that may appear in these posts that you may be leaving the Dale Harris Educational Software website and that the content of those sites is the sole resposibility of the authors of those sites.

Moderators:daleadmin, Dale Harris, Alan, Andrew

capn_buzzcut
Posts:4
Joined:Tue Jan 27, 2004 2:24 pm
How to run POS on a Linux box

Post by capn_buzzcut » Thu Mar 10, 2005 11:12 am

OK, I mentioned about a year ago that I was running POS on a Linux box, but never took the time to detail my configuration. My hardware at the time was an old 486, but I recently dug an old telecom server out of someone's trash (honest, it was even covered with snow) and made it my new POS system. Anyway, here's how I've got the system set up.

First of all, my hardware. The old box I dug up has a 200mhz PentiumMMX processor, 92megs of RAM, and a 2gig SCSI hard disk. I added a spare network card and cdrom drive to round things out. My printer is an old Okidata ML320 that we've had for years, and a 15" monitor from back in the day. I already had a "CueCat" barcode scanner that I'd picked up on Ebay for about $15 a while back.

To start with, I installed Debian Sarge on the system. Sarge is currently Debian's "testing" version, but it's plenty stable and secure for this purpose. Along with the base system, I installed "dosemu" (DOS emulator), samba (Windows compatible fileserver), and mirrordir (a backup tool I like). I also compiled a custom kernel, but that's just me, the stock one will work fine. Since there's no need for a graphical desktop, I didn't install any - the system will be a text console only, just like God intended.

Once the Debian system was up and running OK, I created a /home/pos folder and configured samba to share it on the network. I downloaded POS 6.28c from my Windows desktop and extracted the contents to the new pos share on the network. Since my POS system will be dedicated to that task, I wanted to set it up so that all one has to do is login with the correct username and the POS system would launch automagically. First of all, I made the following changes to the dosemu configuration, which in Debian is stored at /etc/dosemu/dosemu.conf :

## dosemu.conf ##
$_cpu = "80586"
$_rdtsc = (on)
$_hogthreshold = (0)
$_term_char_set = "ibm"
$_mouse_internal = (off)
$_joy_device = ""

I also added this to the end of the emulator's autoexec.bat file, which in Debian is stored at /etc/freedos/autoexec.bat :

## autoexec.bat ##
lredir f: linux\fs\home\pos\
d:
call d:\startpos.bat
unix -e

The last line "unix -e" is there by default, my changes are above it. The first line creates another dos drive called f: in the /home/pos folder. The dosemu package comes already set up to create the user's home directory as the d: drive, so what I'm doing here is attempting to call another batch file which will continue the POS system loading process. My POS user, let's call him "dale", then gets a file in his home folder /home/dale/startpos.bat. That file looks like this:

## startpos.bat ##
REM This file launches the POS system
f:
pos
exitemu

As you can see, this batch file is basically a wrapper for the pos executable. At this point, if user dale logs in and runs the "dosemu" command, it will launch dosemu, then the POS system, and when that's closed, then dosemu will automatically exit. But I wanted it even simpler than that, so I added the following. I added another file called /home/dale/startpos, which is a bash script that looks like this:

## startpos ##
#!/bin/bash
## Turn off screen blanking
echo "Turning off screen blanking..."
setterm -blank 0
## Turn on caps lock
echo "Turning on caps lock..."
setleds +num
## Launch the dosemu environment
echo "Launching DOS emulation..."
dosemu
## After dosemu exits...
echo "Resetting screen blanking to defaults..."
setterm -blank 15
echo "Logging out..."

Don't forget to make the file executable with chmod +x. The setleds program is part of Debian's "console-tools" package, so you may need to install that if you didn't already. And now the final bit of magic is to modify dale's /home/dale/.bash_profile by adding this at the end:

## .bash_profile ##
## Launch the POS system
/home/dale/startpos
## Logout after the startpos script is done
exit

This is all a little confusing, so let's see what's happening here:
At login, dale's .bash_profile is automatically run by the system
dale's .bash_profile calls the startpos bash script
Control passes to startpos
startpos sets up the environment and launches dosemu
Control passes to dosemu
dosemu runs it's autoexec.bat, which tries to call startpos.bat
Control passes to startpos.bat
startpos.bat runs the pos executable
The pos program is eventually closed by the user
Control passes back to startpos.bat
startpos.bat exits dosemu
Control passes back to the startpos bash script
startpos resets the environment
Control passes back to dale's .bash_profile
dale's .bash_profile logs him out

In this way, dale doesn't have to interact with the Linux command line at all, just login and he's up and running. Then when he closes the pos system, he doesn't even have to remember to log out, since it's magically done for him too.

After configuration within the pos system, my printer just plain worked right out of the box (your mileage may vary). The little CueCat is a keyboard wedge type connection, so scanning a barcode works just fine too. There's one little caveat I have, and that's that apparently the ibm font doesn't display up and down arrows properly, but I can live with it. Actually, if you didn't know the system was running Linux, you'd probably never even know it.

Using Samba to share the pos folder on the network allows me to update the pos software easily from my own desktop if I want to, or even run pos from another computer.

So you must be wondering why I'd trust all my POS data to hardware that I dug outta the trash, right? One word: "backup". I set up scripts that run automatically each night to back up everything in the /home folder. Here's how. First of all, I have an NFS server on my network that's dedicated to holding backups. I created 5 scripts (one for each day of the workweek) on the pos system that each look like this:

## 1monday ##
#!/bin/sh
# Mount the backup directory
mount -o soft,timeo=500,intr -t nfs 192.168.1.11:/pos_backup /mnt/snap
# Mirror our /home directory to the proper day
mirrordir --exclude /home/Z--keep-me /home /mnt/snap/1monday/home
# Unmount the Snapserver
umount /mnt/snap

Then I set root's crontab to look like this:

## root's crontab ##
30 19 * * 1 /etc/scripts/backup/1monday
30 19 * * 2 /etc/scripts/backup/2tuesday
30 19 * * 3 /etc/scripts/backup/3wednesday
30 19 * * 4 /etc/scripts/backup/4thursday
30 19 * * 5 /etc/scripts/backup/5friday

So, at 7:30 each weekday evening, the pos box mirrors it's home directory to that day's folder on the server. That means I always have an entire week's worth of backups at any given time.

Sorry to be so long winded about this. Last time I set this up, I didn't make myself notes and had to figure it all out again. This time I did make notes, so hopefully it will come in handy for someone else as well.

Post Reply

Who is online

Users browsing this forum: No registered users and 31 guests