Ariën Huisken wrote:
>> But I don't really see why my last suggestion "wont work" ..
>> If it *doesn't* work, something is just likely slightly off..
>
> It's more on my side not beeing a script guru.. :) but got it working
> (I'm sure it can be done differently, more efficient, well it works...)
Indeed.. This part just duplicates a lot of logic..
> # Extract jpeg from RAW in .crw and .CRW files
> for rawimage in $WORKDIR/$INPUT/*.{crw,CRW}; do
> if [ -f $rawimage -a -z "`lsof $rawimage 2>/dev/null`" ]; then
> filename=`basename $rawimage`
> dcraw -e -c $rawimage > $WORKDIR/$JPEGOUT/$filename.jpg
> chmod 660 $WORKDIR/$JPEGOUT/$filename.jpg
> chown root:users $WORKDIR/$JPEGOUT/$filename.jpg
> mv $rawimage $WORKDIR/$RAWOUT/$filename
> fi
> done
>
> # Move non-RAW files to $NOIMAGE
> for noimage in $WORKDIR/$INPUT/*; do
> if [ -f $noimage -a -z "`lsof $noimage 2>/dev/null`" ]; then
> echo $noimage | grep -qi '.crw$'
> if [ $? -gt 0 ]; then
> mv $noimage $WORKDIR/$NOIMAGE/`basename $noimage`
> fi
> fi
> done
umask 007
for file in $WORKDIR/$INPUT/*; do
if [ -f $filename -a -z "`lsof $filename 2>/dev/null`" ]; then
echo $file | grep -qi 'crw$';
if [ $? -gt 0 ]; then
mv $noimage $WORKDIR/$NOIMAGE/`basename $noimage`
else
fn=`basename $filename`
dcraw -e -c $filename > $WORKDIR/$JPEGOUT/${fn}.jpg
chgrp users $WORKDIR/$JPEGOUT/${fn}.jpg
mv $filename $WORKDIR/$RAWOUT/$fn
fi
fi
done
oh, btw.. to protect against launching multiple instances;
if [ -f /var/lock/subsys/dcraw ]; then
echo 'Lock-file found!'
exit 1
fi
touch /var/lock/subsys/dcraw
....
rm /var/lock/subsys/dcraw
.. I would run such a script from cron rather than a backgrounded
process looping..
--
Morten
:wq
_______________________________________________
tsl-discuss mailing list
[email protected]
http://lists.trustix.org/mailman/listinfo/tsl-discuss