Last active
August 29, 2015 14:15
-
-
Save mklooss/7a79db2d67821e8642e0 to your computer and use it in GitHub Desktop.
automatic print pdf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
*/1 * * * * root find /printer -iname "*.pdf" -exec printpdf "{}" \; > /dev/null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
DATE=`date` | |
PRINTER=Brother_DCP-9055CDN | |
# check if file already printed and try to remove this file | |
if [ -f "/tmp/printed.tmp" ]; then | |
while read p; do | |
if [ "$p" = "$1" ]; then | |
rm -f "$1" | |
echo "'$1' already printed" | |
exit | |
fi | |
done </tmp/printed.tmp | |
fi | |
echo "$DATE print file $1" >> /var/log/printpdf.log | |
lp -d $PRINTER "$1" >> /var/log/printpdf.log | |
echo "$DATE remove $1" >> /var/log/printpdf.log | |
echo $1 >> /tmp/printed.tmp | |
rm -f "$1" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment