From 55299d03ef16b85b5a0f6fc6618a257ff0b4a138 Mon Sep 17 00:00:00 2001 From: Christopher Devlin <chris@oass.site> Date: Thu, 9 Jul 2020 03:34:05 +0000 Subject: [PATCH] Upload New File --- inotprint.sh | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 inotprint.sh diff --git a/inotprint.sh b/inotprint.sh new file mode 100644 index 0000000..332e675 --- /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 + -- GitLab