aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSerge V Shistarev <madlynxed@gmail.com>2013-09-08 19:18:22 +0900
committerSerge V Shistarev <madlynxed@gmail.com>2013-09-08 19:18:22 +0900
commit8d277a9b1a9bd634ae7e435525ae3576bc26b100 (patch)
treedc7d149cac872f55f59fbdbb0280db57e812f0d2
parentf6c2cff604a1ba9d6c5292f03408f073a845d706 (diff)
downloadricoh-sp100-8d277a9b1a9bd634ae7e435525ae3576bc26b100.tar.gz
Code cleanup
-rwxr-xr-xpstoricohddst-gdi20
1 files changed, 7 insertions, 13 deletions
diff --git a/pstoricohddst-gdi b/pstoricohddst-gdi
index 7a19e00..16bdd34 100755
--- a/pstoricohddst-gdi
+++ b/pstoricohddst-gdi
@@ -1,9 +1,7 @@
#!/bin/bash
function trapINT() {
- [ "x$trp" = "x" ] && trp="yes" || return
-# pid=`ps a | grep $uid | grep -v grep | awk ' { print $1 } '`
-# [ ! "x$pid" = "x" ] && { kill $pid; sleep 5; }
+ [ "x$trp" = "x" ] && trp="yes" || return
sleep 3
rm -rf $uid
exit
@@ -13,6 +11,10 @@ function stop() {
echo "stop" > $uid/999999999-page.pbm
}
+function log() {
+ echo $* | logger -t pstoricohddst-gdi
+}
+
trap "stop; trapINT" SIGINT SIGTERM SIGQUIT
#trap 'echo No' SIGINT SIGTERM SIGQUIT EXIT;
# Username
@@ -32,6 +34,7 @@ mkdir -p $uid
(
stage="empty"
inotifywait -q -m -r -e close_write --format '%f' $uid | grep --line-buffered 'page.pbm$' | while read page; do
+ # page submitted
[ "$stage" = "empty" ] && {
# Flushing PJL header
cat <<EOF
@@ -52,7 +55,7 @@ EOF
@PJL EOJ
%-12345X
EOF
- pid=`ps a | grep $uid | grep -v grep | awk ' { print $1 } '`
+ pid=`ps ax | grep $uid | grep -v grep | awk ' { print $1 } '`
[ ! "x$pid" = "x" ] && kill $pid
break
}
@@ -95,16 +98,7 @@ done
# Converting from PostScript to PostScript-monochrome, then to PBM image format (per page)
gs -sDEVICE=psmono -sOutputFile=- -r600 -dQUIET -dBATCH -dNOPAUSE - | gs -sDEVICE=pbmraw -sOutputFile=${uid}/%d-page.pbm -r600 -dQUIET -dBATCH -dNOPAUSE -
-
stop
wait
trapINT
-
-exit
-
-ls $uid/ | grep 'pbm$' | sort -n | while read page; do
-
-
-done
-