scanimage-batchでエラーと「成功」を区別します。

scanimage-batchでエラーと「成功」を区別します。

リモートサーバーでバッチコマンドを使用して小さなスクリプトを実行しており、スキャンがバッチscanimageを完了するかどうかを知りたいです。したがって、後続の手順を処理するには、スクリプトに正しい「エラー」説明が必要です。

しかし、scanimage良い結果を返します奇妙な情報:

scanimage: sane_start: Document feeder out of documents

したがって、成功すると、全体の出力は次のようになります。

scanscript "scanimage --device='brother4:net1;dev0' --format tiff --resolution=150 --source 'Automatic Document Feeder(left aligned,Duplex)' -l 0mm -t 0mm -x210mm -y297mm --batch=$(date +%Y%m%d_%H%M%S)_p%04d.tiff" "/home/qohelet/scans/images/281/" "myscan"
scanimage: rounded value of br-x from 210 to 209.981
scanimage: rounded value of br-y from 297 to 296.973
Scanning -1 pages, incrementing by 1, numbering from 1
Scanning page 1
Scanned page 1. (scanner status = 5)
Scanning page 2
Scanned page 2. (scanner status = 5)
Scanning page 3
scanimage: sane_start: Document feeder out of documents

技術的にこれは正しいです。はい。ただし、作業が完了すると常にこれが発生します。フィーダに用紙をセットしない場合は、次のようになります。

scanscript "scanimage --device='brother4:net1;dev0' --format tiff --resolution=150 --source 'Automatic Document Feeder(left aligned,Duplex)' -l 0mm -t 0mm -x210mm -y297mm --batch=$(date +%Y%m%d_%H%M%S)_p%04d.tiff" "/home/qohelet/scans/images/281/" "myscan"
scanimage: rounded value of br-x from 210 to 209.981
scanimage: rounded value of br-y from 297 to 296.973
Scanning -1 pages, incrementing by 1, numbering from 1
Scanning page 1
scanimage: sane_read: Error during device I/O
Scanned page 1. (scanner status = 9)

残念ながら、エラー9は出力の一部にすぎません。投げられたのはどうすればわかりますか?

私の例では、scanscriptifを使用してスキャンが成功したかどうかを評価しました。

if eval $1; then
    #Do stuff
else
    #Do error stuff and exit with error code
fi

残念ながらscanimage、一括で使用すると、常に失敗として扱われます。正確に何が起こったのかを知る方法はありますか?

誰かが他のスキャナーで同様の問題を経験したようです(私はブラザースキャナーを持っていますが、実際には質問には関係ありません)。 http://sane.10972.n7.nabble.com/Issue-with-Fujitsu-ScanSnap-iX500-td18589.html

ところが話題が続かないので、もうここに閉じ込められてどうするべきか悩みになります。

ベストアンサー1

おすすめ記事