scanbd Post Processing

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

scanbd Post Processing

ylafont
Forgive me if this  not the correct section  for this.

I wanted to start a bash script to process the completed scans. I created a link to Scan.sh from test.script

test.script -> scan.sh

A section of scan.sh contains the following when scanning via the ADF

if [ $SCANBD_ACTION -eq "paperload" ] && [ $SCANBD_FUNCTION -eq 2 ]; then

logger -t "scanbd: $0" "************* Now Scanning on device $SCANBD_DEVICE ***************"
scanimage -d $SCANBD_DEVICE -y 279.4 -x 215.9 --batch --format=tiff --mode Lineart --resolution 300 --source="ADF Duplex"

logger -t "scanbd: $0" "************* Scanning ended on device $SCANBD_DEVICE ***************"
fi

logger -t "scanbd: $0" "End of $SCANBD_ACTION for device $SCANBD_DEVICE"
Removing blank pages and cleaning all others.
logger -t "scanbd: $0" "**** Starting Page Removal Process **"

. ./premove.sh   <--------- Post processing script

After the scanner completes the scan the script is terminated and does not allow processing to continue.
Feb 10 00:38:14 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: **** Scanning ended on device fujitsu:fi-4220C2dj:100742 **
Feb 10 00:38:14 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: End of scan for device fujitsu:fi-4220C2dj:100742
Feb 10 00:38:14 PiScanner scanbd: /usr/local/sbin/scanbd: child /usr/local/etc/scanbd/scan.sh exited with status: 1
Feb 10 00:38:15 PiScanner scanbd: /usr/local/sbin/scanbd: append string fujitsu:fi-4220C2dj:100742 to signal scan_end
Feb 10 00:38:15 PiScanner scanbd: /usr/local/sbin/scanbd: now sending signal scan_end


Is there a method allowing the second script to continue and process the pages scanned?
Reply | Threaded
Open this post in threaded view
|

Re: scanbd Post Processing

Wilhelm Meier-2
Am 10.02.2015 um 04:30 schrieb ylafont:

> Forgive me if this  not the correct section  for this.
>
> I wanted to start a bash script to process the completed scans. I created a
> link to Scan.sh from test.script
>
> test.script -> scan.sh
>
> A section of scan.sh contains the following when scanning via the ADF
>
> if [ $SCANBD_ACTION -eq "paperload" ] && [ $SCANBD_FUNCTION -eq 2 ]; then
>
> logger -t "scanbd: $0" "************* Now Scanning on device $SCANBD_DEVICE
> ***************"
> scanimage -d $SCANBD_DEVICE -y 279.4 -x 215.9 --batch --format=tiff --mode
> Lineart --resolution 300 --source="ADF Duplex"
>
> logger -t "scanbd: $0" "************* Scanning ended on device
> $SCANBD_DEVICE ***************"
> fi
>
> logger -t "scanbd: $0" "End of $SCANBD_ACTION for device $SCANBD_DEVICE"
> Removing blank pages and cleaning all others.
> logger -t "scanbd: $0" "**** Starting Page Removal Process **"
>
> *. ./premove.sh*   <--------- Post processing script

Is the above line part of the scan-script?

You can only use *one* script for one action.

>
> After the scanner completes the scan the script is terminated and does not
> allow processing to continue.
> Feb 10 00:38:14 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: ****
> Scanning ended on device fujitsu:fi-4220C2dj:100742 **
> Feb 10 00:38:14 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: End of scan
> for device fujitsu:fi-4220C2dj:100742
> Feb 10 00:38:14 PiScanner scanbd: /usr/local/sbin/scanbd: child
> /usr/local/etc/scanbd/scan.sh exited with status: 1

The scan-script terminates with an error - this might be a problem...

> Feb 10 00:38:15 PiScanner scanbd: /usr/local/sbin/scanbd: append string
> fujitsu:fi-4220C2dj:100742 to signal scan_end
> Feb 10 00:38:15 PiScanner scanbd: /usr/local/sbin/scanbd: now sending signal
> scan_end
>
>
> Is there a method allowing the second script to continue and process the
> pages scanned?
>
>
>
> --
> View this message in context: http://sane.10972.n7.nabble.com/scanbd-Post-Processing-tp19426.html
> Sent from the SANE - Dev mailing list archive at Nabble.com.
>


--
Wilhelm
[hidden email]

--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: scanbd Post Processing

ylafont
Yes,

the last line of the script, calls a script to process the scans,  

The complete scan.sh.  is as follows.
________________________________________________________________
logger -t "scanbd: $0" "Begin of $SCANBD_ACTION for device $SCANBD_DEVICE"

# printout all env-variables
/usr/bin/printenv > /tmp/scanbd.env

CurrentDir=$(pwd) #Script Starting Directory
scandir="/home/pi/PiScans" #Scanning Directory
tmpdir=Scan-$RANDOM #Script temporary Directory of processing.

mkdir $scandir/$tmpdir
cd $scandir/$tmpdir

if  [ $SCANBD_FUNCTION -eq 2 ]; then
#if [ $SCANBD_ACTION -eq "paperload" ] && [ $SCANBD_FUNCTION -eq 2 ]; then
        logger -t "scanbd: $0" "************* Now Scanning on device $SCANBD_DEVICE ***************"
        #scanimage -d net:localhost:fujitsu:fi-4220C2dj:100742 -y 279.4 -x 215.9 --batch --format=tiff --mode Lineart --resolution 300 --source="ADF Duplex"
        scanimage -d $SCANBD_DEVICE -y 279.4 -x 215.9 --batch --format=tiff --mode Lineart --resolution 300 --source="ADF Duplex"
        logger -t "scanbd: $0" "************* Scanning ended on device $SCANBD_DEVICE ***************"
fi

. ./premove.sh

logger -t "scanbd: $0" "End   of $SCANBD_ACTION for device $SCANBD_DEVICE"
___________________________________________________________________________


I had also address the error - but the second script which is in the same location as scan.sh does not execute.

Feb 11 02:19:18 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: Begin of scan for device fujitsu:fi-4220C2dj:100742
Feb 11 02:19:18 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: ************* Now Scanning on device fujitsu:fi-4220C2dj:100742 ***************
Feb 11 02:19:19 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:20 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:21 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:22 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:23 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:24 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:25 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:26 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus call
Feb 11 02:19:27 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: ************* Scanning ended on device fujitsu:fi-4220C2dj:100742 ***************
Feb 11 02:19:27 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: This this End  ***********  of scan for device fujitsu:fi-4220C2dj:100742
Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: child /usr/local/etc/scanbd/scan.sh exited with status: 0
Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: append string fujitsu:fi-4220C2dj:100742 to signal scan_end

Reply | Threaded
Open this post in threaded view
|

Re: scanbd Post Processing

Wilhelm Meier-2
Am 11.02.2015 um 03:19 schrieb ylafont:
> Yes,
>
> the last line of the script, calls a script to process the scans,  

You are source-ing the premove.sh.
What happens if you start it by hand? But the problem then isn't related
to scanbd, seems to be bash related.

>
> The complete scan.sh.  is as follows.
> ________________________________________________________________
> logger -t "scanbd: $0" "Begin of $SCANBD_ACTION for device $SCANBD_DEVICE"
>
> # printout all env-variables
> /usr/bin/printenv > /tmp/scanbd.env
>
> CurrentDir=$(pwd) #Script Starting Directory
> scandir="/home/pi/PiScans" #Scanning Directory
> tmpdir=Scan-$RANDOM #Script temporary Directory of processing.
>
> mkdir $scandir/$tmpdir
> cd $scandir/$tmpdir
>
> if  [ $SCANBD_FUNCTION -eq 2 ]; then
> #if [ $SCANBD_ACTION -eq "paperload" ] && [ $SCANBD_FUNCTION -eq 2 ]; then
> logger -t "scanbd: $0" "************* Now Scanning on device $SCANBD_DEVICE
> ***************"
> #scanimage -d net:localhost:fujitsu:fi-4220C2dj:100742 -y 279.4 -x 215.9
> --batch --format=tiff --mode Lineart --resolution 300 --source="ADF Duplex"
> scanimage -d $SCANBD_DEVICE -y 279.4 -x 215.9 --batch --format=tiff --mode
> Lineart --resolution 300 --source="ADF Duplex"
> logger -t "scanbd: $0" "************* Scanning ended on device
> $SCANBD_DEVICE ***************"
> fi
>
> . ./premove.sh
>
> logger -t "scanbd: $0" "End   of $SCANBD_ACTION for device $SCANBD_DEVICE"
> ___________________________________________________________________________
>
>
> I had also address the error - but the second script which is in the same
> location as scan.sh does not execute.
>
> Feb 11 02:19:18 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: Begin of
> scan for device fujitsu:fi-4220C2dj:100742
> Feb 11 02:19:18 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh:
> ************* Now Scanning on device fujitsu:fi-4220C2dj:100742
> ***************
> Feb 11 02:19:19 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:20 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:21 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:22 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:23 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:24 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:25 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:26 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: Iteration on dbus
> call
> Feb 11 02:19:27 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh:
> ************* Scanning ended on device fujitsu:fi-4220C2dj:100742
> ***************
> Feb 11 02:19:27 PiScanner scanbd: /usr/local/etc/scanbd/scan.sh: This this
> End  ***********  of scan for device fujitsu:fi-4220C2dj:100742
> Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: child
> /usr/local/etc/scanbd/scan.sh exited with status: 0
> Feb 11 02:19:27 PiScanner scanbd: /usr/local/sbin/scanbd: append string
> fujitsu:fi-4220C2dj:100742 to signal scan_end
>
>
>
>
>
> --
> View this message in context: http://sane.10972.n7.nabble.com/scanbd-Post-Processing-tp19426p19430.html
> Sent from the SANE - Dev mailing list archive at Nabble.com.
>


--
Wilhelm
[hidden email]

--
sane-devel mailing list: [hidden email]
http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/sane-devel
Unsubscribe: Send mail with subject "unsubscribe your_password"
             to [hidden email]
Reply | Threaded
Open this post in threaded view
|

Re: scanbd Post Processing

ylafont
This post was updated on .
Honestly, i thought that was comment  out.  I Had tried a few thins to see what was working or not.   Regardless that was the not the problem.

Haven't quite figure it out. Although it makes no sense the  only thing that has worked is to place

cd $CurrentDir before the script is executed.  

I would expect the $Currentdir to be be /usr/local/etc/scanbd, however it is recorded as "/"

some funky things go on as well like directories are not changes when a cd command is issued, which screws most of the script.  these are some of the variables being echoed to files as scripts are executed.

pi@PiScanner ~ $ cat /tmp/test.txt
Scan.sh scandir = /home/pi/PiScans
Scan.sh tmpdir = Scan-3702
Scan.sh CurrentDir = /
Nextscan scandir /home/pi/PiScans
Nextscan tmpdir Scan-3702
Nextscan CurrentDir /
Present Working Directory = /



Will have watch the folder for new files for now.