[Samba-it] server fax
Piero.Conte at VenetaNastri.it
Piero.Conte at VenetaNastri.it
Fri Aug 1 09:43:01 MDT 2003
Saluti a tutti,
avrei bisogno di un aiuto. Sto mettendo su un server fax, quindi mi sono
documentato.
Sono in possesso del seguente script, dove si vede che una variabile
fondamentale e UTENTE che viene acquisito dove c'è get parameters
#!/bin/sh
###########################################################################
# #
# faxfilter for mgetty+sendfax #
# #
# #
# Author : Wundrig Roland <roland at cygnus.muc.de> #
# #
# changes : 26.08.1995 Programm erstellt #
# 16.02.1999 modified for use with (nearly) #
# all word-processors printing PostScript #
# <Christoph.Meier at fernuni-hagen.de> #
# #
###########################################################################
#
#
# Installation (SuSE):
#
# you must have been installed:
#
# serie a gawk
# serie ap gs, gs_lib, gs_fonts
# serie n mgetty, sendfax
#
# add to your /etc/printcap:
#
# faxlp|fax_now:\
# :lp=/dev/null:\
# :sd=/var/spool/lpd/faxspool:\
# :lf=/var/spool/lpd/faxspool/err.log:\
# :if=/var/spool/faxspool/faxfilter:\
# :sh:\
# :sf:\
# :mx#0:
#
# place this (faxfilter) scripts in /var/spool/lpd/faxspool
# and make it executable.
#
###########################################################################
#
# How to fax:
#
# Add to your Text the following text:
# Fax-Nr : 012-3456-789
# where 012-3456-789 is the fax number (without spaces!).
#
# You can use either upper- or lowercase characters for 'Fax-Nr :'.
# The Text 'Fax-Nr:' have to be as is, with or without blanks.
#
# Now print it as Postscript to 'faxlp'
#
# The filter converts the PS-file to ASCII and scans the ASCII-file
# for the 'Fax-Nr : '... .
# If a fax-number is found the PS-file will be processed by faxspool with
# that fax-number.
#
# The sender will receive a mail, wether the fax was sent or an error
# ocurred while scanning the fax-number.
#
# If you have installed SAMBA you can add the fax-printer in SMB.conf
# described by /usr/doc/packages/samba/textdocs/Faxing.txt.
# Then you are able to use your fax-modem with MS-Windows.
#
# have much fun :-)
#
# P.S.: You may install two fax-devices. One for sending immediately
# and one for delayed sending of faxes.
#
###########################################################################
#
# Settings
#
# uncomment for delayed sending after 18:00 (for example)
# and add '-t $SENDTIME' to the faxspool-command at the end of this script
#SENDTIME="18:00"
# use mail for sending status back
#
MAILER="/bin/mail"
PATH="$PATH:/usr/X11/bin"
# store temporary files to:
#
FAXFILE=/tmp/tmp_faxlp.$$
FAXTEXT=/tmp/tmp_faxtxt.$$
USERNAME=""
HOSTNAME=""
umask 027
# get parameters
#
while :
do
case "$1" in
# catch username
-n) USERNAME="$2"
shift ; shift
;;
# catch hostname
-h) HOSTNAME="$2"
shift ; shift
;;
# ignore anything else
-*) shift
;;
# exit loop
*) break
esac
done
# If no username is given use Postmaster as mailadress
#
if [ "$USERNAME" = "nobody" ];
then
MAILNAME="postmaster"
else
MAILNAME=$USERNAME
fi
# save fax to temp-folder
#
cat > $FAXFILE
# convert PS to ASCII for fax-number checking
# and save to temp-folder
#
/usr/bin/ps2ascii $FAXFILE $FAXTEXT
# scanning fax-text for phone-number
#
TELEPHONE=`awk '{ IGNORECASE=1 } /FAX-NR ?: ?[0-9-]*/ \
{ gsub(/-/,""); \
anfang=match($0,/ ?: ?/); \
anfang=anfang+match(substr($0,anfang),/[0-9]/)-1; \
ende=match(substr($0,anfang),/\>/)-1; \
printf ("%s",substr($0,anfang,ende)) \
}' $FAXTEXT`
# remove ASCII-File
#
rm $FAXTEXT
# fax-number found? -> send fax
# else send error-message
#
if [ "$TELEPHONE" = "" ];
then
# send error-message
#
(
echo "Error! Can't find fax-number in the text!"
echo
echo "1) Try again with (maybe in a seperate line):"
echo " FAX-NR : XXXX-XXXX"
echo " where the X are the numbers of the destination
fax-number."
echo "2) Don't use any characters between the numbers."
echo "3) The Fax-Nr should appear only once in the text."
echo
echo "If nothing works, contact your fax-administrator."
) | \
$MAILER -s "FAX ERROR" $MAILNAME
else
# SENDING THE FAX
# add ' -t $SENDTIME' after 'faxspool' to the following line
# if you want to sent delayed
# be sure you uncommented SENDTIME="18:00" at the beginning
# of the script
faxspool -u $USERNAME -f $USERNAME $TELEPHONE $FAXFILE 2>&1 | \
$MAILER -s "Fax sent to # $TELEPHONE #" $MAILNAME
fi
# remove temporary FAXFILE
#
rm $FAXFILE
exit 0
Poi su samba devo fare la seguente configurazione:
printcap name = /etc/printcap
print command = /usr/bin/lpr -r -P %p %s
lpq command = /usr/bin/lpq -P %p
plrm command = /usr/bin/plrm -P %p %j
Ecco io non riesco proprio a capire come arrivi il nime utente allo script
sopra. Infatti non
arriva e non funziona niente.
Ho proprio bisogno di un aiuto per correggere od eventualmente trovare un
altro
sistema per passare l'utente.
Ringrazio tutti
Piero
More information about the samba-it
mailing list