• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1450
  • Last Modified:

How to print to a print server from SCO Unix 507

I'm running SCO OSR 5.0.7 and my server IP is 192.168.2.7 , I want to setup a printer using a print server module Dlink DP-301P+, I setup the print server to be IP 192.168.2.17.
How can I create a printer on the SCO unix that prints to that IP address ?
0
henry007
Asked:
henry007
  • 2
1 Solution
 
omarfaridCommented:
0
 
henry007Author Commented:
It gave the idea and I fine tune it using netcat so it prints on a epson by copying the model epson to /usr/spool/lp/admins/lp/interfaces/model.orig (I use the name of the printer instead of "epson")  from the /usr/spool/lp/model   then I just created the /etc/host entry as 192.168.2.17 rmain mydomain.net... and added the printer using a /dev/null and then this has to be at /usr/spool/lp/model
0
 
henry007Author Commented:
here's the script  that I was talking about in the previous comment :

#!/bin/sh
YOUR_PRINTER_OR_IP="192.168.2.4"
PORT=9100
#
#      @(#) hpnp.model 62.2 97/03/03
#
# $Header: hpnp.model,v 1.9 91/11/14 10:44:35 pma Exp $
#
#      Copyright (C) 1991-1997 The Santa Cruz Operation, Inc.
#            All Rights Reserved.
#      The information in this file is provided for the exclusive use of
#      the licensees of The Santa Cruz Operation, Inc.  Such users have the
#      right to use, modify, and incorporate this code into other products
#      for purposes authorized by the license agreement provided they include
#      this notice and the associated copyright notice with any such product.
#      The information in this file is provided "AS IS" without warranty.
#
# (c)Copyright Hewlett-Packard Company 1991.  All Rights Reserved.
# (c)Copyright 1983 Regents of the University of California
# (c)Copyright 1988, 1989 by Carnegie Mellon University
#
#                          RESTRICTED RIGHTS LEGEND
# Use, duplication, or disclosure by the U.S. Government is subject to
# restrictions as set forth in sub-paragraph (c)(1)(ii) of the Rights in
# Technical Data and Computer Software clause in DFARS 252.227-7013.
#
#                          Hewlett-Packard Company
#                          3000 Hanover Street
#                          Palo Alto, CA 94304 U.S.A.
#
# HP-UX Network Peripheral Model Script
#
# This script invokes the original model script
# from the subdirectory model.orig and pipes its
# output to hpnpf.
#
# Hpnpf does not exit on signal 15.  Thus, the
# original model script can catch the signal,
# echo a string and exit.  Hpnpf will exit when
# its standard input is closed.
#

MODEL=`basename $0`
REALMODEL=`echo $0 | sed -e "s%$MODEL%model.orig/$MODEL%"`

#
# This name may be initialized when the script is
# installed in the spooler.  If not, use the name
# of this script ($MODEL) as the peripheral to contact.
#
PERIPH=
if [ "$PERIPH" = "" ]
then
      PERIPH=$MODEL
fi
LOG=/tmp/$PERIPH.$$
HPNPF=/usr/bin/netcat
LPLOG=/tmp/hpnpf.$$
LOGTRIES=5

echo "$1\t$REALMODEL | $HPNPF -x $PERIPH" >> $LPLOG

#
# Remove the log file if job is cancelled
# or the scheduler is shutdown.
#
trap "rm -f $LOG $LPLOG; trap 15;kill -15 0;exit 0" 15

ERRORLOGS=0
while :
do
    #
    # Save the stderr messages in a temporary log file
    # and discard stdout which is the peripheral output.
    #
    rm -f $LOG
    if $REALMODEL "$@" | $HPNPF -h $YOUR_PRINTER_OR_IP -p $PORT  2> $LOG > /dev/null
    then
      #
      # If the transfer is successful, remove
      # the log file and exit.
      #
      rm -f $LOG $LPLOG
      exit 0
    else
      #
      # Added the request ID to the stderr message
      # and store it in the lp log file.
      #
      # Only record the first $LOGTRIES errors.  If
      # the spooler gets in a loop retrying a job, the
      # disk won't fill up with spooler log error messages.
      #
      if test -s $LOG -a $ERRORLOGS -lt $LOGTRIES
      then
          echo "$1\t`cat $LOG`" >> $LPLOG
          ERRORLOGS=`expr $ERRORLOGS + 1`
      fi
      if test $ERRORLOGS -eq $LOGTRIES
      then
          echo "$1\t$LOGTRIES errors logged for $1; errors no longer logged" >> $LPLOG
          ERRORLOGS=`expr $ERRORLOGS + 1`
      fi
    fi
    if [ ! -s $LPLOG ]
    then
      rm -f $LPLOG
    fi
    sleep 10
done
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Introducing Cloud Class® training courses

Tech changes fast. You can learn faster. That’s why we’re bringing professional training courses to Experts Exchange. With a subscription, you can access all the Cloud Class® courses to expand your education, prep for certifications, and get top-notch instructions.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now