vicker313 tech blog

July 1, 2009

Add header to printout in HPUX using not JetDirect

Filed under: HPUX — Tags: , — vicker313 @ 8:00 am

This post is continue from Add header to printout in HPUX using JetDirect, if you’re not using JetDirect but other print server such as DLINK, you might use method below to set your printout header:

  1. Add your queues using System Administrator Manager (SAM): sam
  2. Go to our destination: cd /usr/bin.
  3. Create a file called enbanner. This is used to set which queue to print out header and which don’t, simply 1 stand for yes and 0 stand for no, and it is space sensitive (10 character space for the queue name). Here is the sample:
    prt1      1
    prt2      0
  4. You can found an execution file called lp, rename it to lporig: mv lp lporig.
  5. create a text file called lp and put in the following code:
    #!/sbin/sh
    TEMP=/tmp/printmp
    printer=`echo $1 | /usr/bin/cut -b 3-100`
    enbanner=`cat /usr/bin/enbanner | grep $printer | cut -c11`
    if [ `expr $enbanner` != 0 ]
    then
    /usr/bin/lp2 $1 $2 $TEMP
    /usr/bin/lporig $1 $TEMP $2
    rm $TEMP
    else
    /usr/bin/lporig $1 $2
    fi
  6. create a text file called lp2 and put in the following code:
    #!/bin/sh
    fname=$2
    TEMP=$3
    printer=`echo $1 | /usr/bin/cut -b 3-100`


    do_banner()
    {
    # Print the standard header
    banner TESTING
    account=`whoami`
    banner $account
    banner `basename $fname`
    echo "\n"
    reqque=`cat /var/spool/lp/seqfile`
    reqqueadd=`expr $reqque + 1`
    reqid=$printer-$reqqueadd
    echo "Request id: $reqid Printer: `basename $printer`\n"
    date
    echo "\n"

    echo "\f\r\c"
    }

    echo "" > $TEMP
    do_banner >> $TEMP
  7. Then make lp and lp2 executable:
    chmod 777 lp
    chmod 777 lp2
  8. Now you can try to print out the header, depend on the setting at enbanner.
Advertisements

Leave a Comment »

No comments yet.

RSS feed for comments on this post. TrackBack URI

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Blog at WordPress.com.

%d bloggers like this: