Return to BSD News archive
Path: euryale.cc.adfa.oz.au!newshost.carno.net.au!harbinger.cc.monash.edu.au!news.mel.connect.com.au!news.syd.connect.com.au!news.bri.connect.com.au!fw.defiance.com.au!usenet
From: "Jamie Townsend" <jamiet@defiance.com.au>
Newsgroups: comp.unix.bsd,comp.unix.bsd.misc
Subject: Email from lpr
Date: 23 Dec 1996 07:18:25 GMT
Organization: Defiance Mills Ltd
Lines: 46
Message-ID: <01bbf098$f9628820$f5010e0a@pc1445.defiance.com.au>
NNTP-Posting-Host: 10.14.1.245
X-Newsreader: Microsoft Internet News 4.70.1155
Xref: euryale.cc.adfa.oz.au comp.unix.bsd:16856 comp.unix.bsd.misc:1856
We are trying to set up a printer under lpr that redirects output to an
email sent to the user invoking the lpr command. Because lpd is run by
deamon any attempt to use `whoami` or the like to get the userid in the
script in the spool directory is useless. (I have included a copy of the
redirection script below)
Does anyone know how to get a userid from within the lpr printer
redirection script??
Thanks in advance,
Jamie
PS - Could any replies be directed to me off line at:
jamiet@defiance.com.au
____________________________________________________________
#!/bin/ksh
# retry loop for accessing printer connected to spider port
#
cat - > /tmp/LP$$
# This is the bit that doesn't work. `whoami` returns deamon
MailUser=`whoami`
i=1
while [ $i -le 15 ]
do
echo "cat /tmp/LP$$ | mailx -s "System Report" $MailUser" > /tmp/x
status=$?
if [ $status = 0 ]
then
rm /tmp/LP$$
touch /tmp/mail.worked
exit 0
fi
sleep 10
i=`expr $i + 1`
done
rm /tmp/LP$$
exit $status
____________________________________________________________