summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog10
-rwxr-xr-xpdfdistiller22
2 files changed, 22 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index 4a677ae..409415e 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -9,6 +9,16 @@
--
+2002-08-15 09:42 klaus
+
+ * ChangeLog, cacti/gettemperature.sh:
+
+ * I created a nice little script which is capable of getting the temperature of any
+ METAR weatherstation and return it in fahrenheit and celsius.
+ I designed it to use with Cacti, a PHP based RRD tools frontend.
+ More info at http://www.raxnet.net.
+ Expect a hack of it to show other weatherdata in the next couple of days.
+
2002-08-13 08:04 klaus
* pdfdistiller:
diff --git a/pdfdistiller b/pdfdistiller
index c97b7dd..6a6497d 100755
--- a/pdfdistiller
+++ b/pdfdistiller
@@ -49,19 +49,23 @@ fi
echo "PDF directory: $PDFDIR" >> $LOGFILE
+user=$2
+# Avoid email to non-user accounts
+case "$user" in
+ nobody|guest) user=;;
+esac
+
# generate output filename
OUTPUTFILENAME=
-#I found out that when the user 'nobody' prints, the script tries to mail the PDF
-#to that user - as a local mail. To avoid this, I changed the conditions in the if-statement below.
-if [ "$2" = "" -o "$2" = "nobody" ]; then
+if [ "$user" = "" ]; then
OUTPUTFILENAME="$PDFDIR/unknown-$PRINTTIME.pdf"
else
# OUTPUTFILENAME="$PDFDIR/${3//[^[:alnum:]]/_}.pdf"
# I changed this to user name, and the printtime to track down who
# printed the PDF and when, samba printing just uses nobody
- OUTPUTFILENAME="$PDFDIR/$2-$PRINTTIME.pdf"
+ OUTPUTFILENAME="$PDFDIR/$user-$PRINTTIME.pdf"
echo "PDF file: $OUTPUTFILENAME placed in: $PDFDIR" >> $LOGFILE
fi
@@ -80,17 +84,15 @@ fi
# - owns to user specified in argument
chmod a+r $OUTPUTFILENAME
-#An extra argument in this statement proved to be needed to ensure that after entering
-#the previous if-statement (in case user is nobody) this if-statement isn't entered as well..
-if [ "$2" != "" -a $2 != "nobody" ]; then
+if [ "$user" != "" ]; then
if [ -x /usr/bin/mime-construct ]; then
- /usr/bin/mime-construct --to "$2" --subject "PDF print" --type application/pdf --attachment `basename $OUTPUTFILENAME` --file $OUTPUTFILENAME \
+ /usr/bin/mime-construct --to "$user" --subject "PDF print" --type application/pdf --attachment `basename $OUTPUTFILENAME` --file $OUTPUTFILENAME \
&& rm $OUTPUTFILENAME
elif [ -x /usr/bin/mimeit ]; then
- cat $OUTPUTFILENAME | /usr/bin/mimeit application/pdf $2 "PDF print" \
+ cat $OUTPUTFILENAME | /usr/bin/mimeit application/pdf $user "PDF print" \
&& rm $OUTPUTFILENAME
else
- chown $2 $OUTPUTFILENAME
+ chown $user $OUTPUTFILENAME
fi
fi