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 9# uses the smbclient program to print the file to the specified smb-based 10# server and service. 11# 12# To add this to your lp system, copy this file into your samba directory 13# (the example here is /opt/samba), modify the server and service variables 14# and then execute the following command (as root) 15# 16# lpadmin -punixprintername -v/dev/null -i/opt/samba/smbprint 17# 18# where unixprintername is the name that the printer will be known as 19# on your unix box. 20# 21# the script smbprint will be copied into your printer administration 22# directory (/usr/lib/lp or /etc/lp) as a new interface 23# (interface/unixprintername) 24# Then you have to enable unixprintername and 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 at the samba client. 31# 32# Set these to the server and service you wish to print to 33# In this example I have a WfWg PC called "lapland" that has a printer 34# exported called "printer" with no password. 35# 36# clear out the unwanted parameters 37shift;shift;shift;shift;shift 38# now the argument list is just the files to print 39 40server=admin 41service=hplj2 42password="" 43 44( 45# NOTE You may wish to add the line `echo translate' if you want automatic 46# CR/LF translation when printing. 47 echo translate 48 echo "print -" 49 cat $* 50) | /opt/samba/smbclient "\\\\$server\\$service" $password -N > /dev/null 51exit $? 52 53