1#!/bin/sh 2# 3# @(#) smbprint.sysv version 1.0 Ross Wakelin <r.wakelin@march.co.uk> 4# 5# Version 1.0 13 January 1995 6# modified from the original smbprint (bsd) script 7# 8# this script is a System 5 printer interface script. It uses the smbclient 9# program to print the file to the specified smb-based server and service. 10# 11# To add this to your lp system, modify the server and service variables 12# and then execute the following command (as root): 13# 14# lpadmin -punixprintername -v/dev/null -i/usr/samba/bin/smbprint 15# 16# where unixprintername is the name that the printer will be known as 17# on your unix box. 18# 19# the script smbprint will be copied into your printer administration 20# directory (/usr/spool/lp) as a new interface (interface/unixprintername) 21# Then you have to execute the following commands: 22# 23# enable unixprintername 24# accept unixprintername 25# 26# This script will then be called by the lp service to print the files. 27# This script will have 6 or more parameters passed to it by the lp service. 28# The first five will contain details of the print job, who queued it etc, 29# while parameters 6 onwards are a list of files to print. We just 30# cat these to the samba client. 31# 32# clear out the unwanted parameters 33 34shift;shift;shift;shift;shift 35 36# now the argument list is just the files to print 37 38# Set these to the server and service you wish to print to 39# In this example I have a PC called "admin" that has a printer 40# exported called "hplj2" with no password. 41# 42server=admin 43service=hplj2 44password="" 45 46# NOTE: The line `echo translate' provides automatic CR/LF translation 47# when printing. 48( 49 echo translate 50 echo "print -" 51 cat $* 52) | /usr/samba/bin/smbclient "//$server/$service" $password -N > /dev/null 53exit $? 54 55