Adjust path for sourcing env variables
This commit is contained in:
parent
190434c039
commit
d6355bfaf8
1 changed files with 7 additions and 4 deletions
11
scan.script
11
scan.script
|
@ -1,15 +1,17 @@
|
||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
outdir=/var/spool/scan/out
|
SCRIPTPATH="$(cd -- "$(dirname "$0")" >/dev/null 2>&1 ; pwd -P)"
|
||||||
RANDOMNUMBER=$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c${1:-16})
|
RANDOMNUMBER=$(cat /dev/urandom | tr -dc A-Za-z0-9 | head -c${1:-16})
|
||||||
DATE=$(date +"%Y-%m-%dT%H%M%S")
|
DATE=$(date +"%Y-%m-%dT%H%M%S")
|
||||||
|
|
||||||
|
outdir=/var/spool/scan/out
|
||||||
outname=$DATE.pdf
|
outname=$DATE.pdf
|
||||||
tmpdir=/tmp/scan-$RANDOMNUMBER
|
tmpdir=/tmp/scan-$RANDOMNUMBER
|
||||||
cloudsendpass=""
|
cloudsendpass=""
|
||||||
cloudsendurl=""
|
cloudsendurl=""
|
||||||
source ./scan.script.env
|
source $SCRIPTPATH/scan.script.env
|
||||||
|
|
||||||
echo "######## TMPDIR $tmpdir ########"
|
echo "###### TMPDIR $tmpdir ######"
|
||||||
mkdir $tmpdir
|
mkdir $tmpdir
|
||||||
|
|
||||||
echo "################## Scanning ###################"
|
echo "################## Scanning ###################"
|
||||||
|
@ -21,6 +23,7 @@ tiffcp -c lzw $tmpdir/*.tiff $tmpdir/combined.tiff
|
||||||
tiff2pdf -o $tmpdir/tiff2pdf.pdf -z -u m -p "A4" -F $tmpdir/combined.tiff
|
tiff2pdf -o $tmpdir/tiff2pdf.pdf -z -u m -p "A4" -F $tmpdir/combined.tiff
|
||||||
|
|
||||||
echo "########## OCRing and optimizing PDF ##########"
|
echo "########## OCRing and optimizing PDF ##########"
|
||||||
|
mkdir -p $outdir
|
||||||
ocrmypdf -l eng+deu --rotate-pages --deskew --clean $tmpdir/tiff2pdf.pdf $outdir/$outname
|
ocrmypdf -l eng+deu --rotate-pages --deskew --clean $tmpdir/tiff2pdf.pdf $outdir/$outname
|
||||||
|
|
||||||
echo "############# Attempting upload ###############"
|
echo "############# Attempting upload ###############"
|
||||||
|
@ -31,7 +34,7 @@ if [ $? -eq 0 ]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
echo "######## Cleaning up $tmpdir ########"
|
echo "##### Cleaning up $tmpdir #####"
|
||||||
rm -rf $tmpdir
|
rm -rf $tmpdir
|
||||||
|
|
||||||
echo "######## Finished scan $outname ########"
|
echo "######## Finished scan $outname ########"
|
||||||
|
|
Loading…
Reference in a new issue