diff --git a/inotprint.sh b/inotprint.sh new file mode 100644 index 0000000000000000000000000000000000000000..332e675319e20ca83f992a5cd231b455f24efc68 --- /dev/null +++ b/inotprint.sh @@ -0,0 +1,29 @@ +#!/bin/bash +echo "starting in " $PWD + +pfile="WLSDFKJN.DRY" #if this file exists remove it +if [ -f $pfile ] ; then + rm $pfile +fi + +#inotifywait will check to see when our .DRY file is closed from being written to and then print it. Will print any time the file is "modified." +inotifywait -m -e close_write $PWD | + while read path action file; do + if [[ "$file" =~ "WLSDFKJN.DRY" ]]; then + # lp prints from the command line + # install cups-pdf to keep copies in pdf form of all receipts if you want them + # lp prints to the default printer, you can change this by using -d + # from the command line, so to print to the CUPS PDF printer, you can + # lp -d PDF WLSDFKJN.DRY; + # to show all printers, type: lpstat -p -d from the command line + lp -d PDF WLSDFKJN.DRY; + if [ $? -eq 0 ] + then + echo "printed" + rm WLSDFKJN.DRY + else + echo "nope!" + fi + fi + done +