Lets assume that you have some common directory/folder, using either NFS or Samba, or even ftp.
On the Windows side have the application create a request file containing named pairs as:
APPLICATION=invoicing\; export APPLICATION
DATE=20090915\; export DATE
NAME="John Doe"\; export NAME
The back slashes are required to escape any unix meta characters. The quotes are required for variables with embedded spaces. Do not leave any white space around the equal sign.
edit: On second reading, the backslashes will not be required unless a unix meta character is embedded within the variable value, such as NAME="Michael O\'Connor"; export NAME :edit
Save the file in the common directory, known as "/u/spool/in" on the unix side.
On the unix side, write a script like the following:
!#/bin/ksh
if [ -r lock.file ]
then
echo `cat $lock.file` is still running >log.file edit: probably should be >>
exit 1
fi
echo $$ >lock.file
list=`ls /u/spool/in`
for file in $list
do
. /u/spool/in/$file
echo $APPLICATION $DATE $NAME >>log.file
my_real_process
mv /u/spool/in/$file /u/spool/out
done
rm lock.file
Some caveats:
Add a routine to /etc/rc2.d to clear any lock files on system start up.
Add a second file to the out folder showing the results of the process.
The windows file will probably have carriage returns and line feeds at the end of each line. If this becomes a problem, use 'tr -d "\r" <infile >outfile' to eliminate them (or dos2unix if you have that)
If you use ftp to transfer the file, send two files for each request, the first containing the data as above, the second as a semaphore file to say that the transfer is complete. Unix will see the text file as soon as it is opened for writing, and may try to process it before the transfer is complete.
edit: When creating a file naming convention, consider the possibility of duplicates, and the options available for the ls command so that jobs are processed in the desired sequence.
Jack