psql db schema test
[mirrors/Kyberia-bloodline.git] / cron / process-images.sh
1 #!/bin/sh
2
3 # XXX do we even need this?
4 # configure_image_new could resize image itself
5
6 # Script na upravu uploadnutych obrazkov k nodes (backend k eventu configure_image_new #2105641)
7 # Spustane z CRONu cca raz za 2 - 5 minut
8
9 # Created & maintained by maniax
10
11 #cd /storage/system/www-root/kyberia.sk/process-img
12
13 echo "`pwd`"; >> /tmp/log1
14
15 PREPARED_FILES=`ls prepared/`
16 CURRENT_DATE=`date`
17
18 for PREPARED_FILE in "$PREPARED_FILES"
19 do
20 echo "[$CURRENT_DATE] Processing file: $PREPARED_FILE" >> process-img.log
21
22 if [ `echo $PREPARED_FILE | grep .upload | wc -l` -eq 1 ]
23 then
24 echo "[$CURRENT_DATE] Skipping file..." >> process-img.log
25 continue
26 fi
27
28 RQ_DIMENSIONS=`echo $PREPARED_FILE | cut -b 1-3`
29 NODE_FILENAME=`echo $PREPARED_FILE | cut -b 5-`
30
31 convert prepared/$PREPARED_FILE -coalesce -resize "$RQ_DIMENSIONSx$RQ_DIMENSIONS>" ready/$NODE_FILENAME
32
33 rm -f prepared/$PREPARED_FILE
34
35 TGT_PART1=`echo "$NODE_FILENAME" | cut -b 1`
36 TGT_PART2=`echo "$NODE_FILENAME" | cut -b 2`
37
38 mv ready/"$NODE_FILENAME" ../images/nodes/"$TGT_PART1/$TGT_PART2/$NODE_FILENAME"
39 chgrp www ../images/nodes/"$TGT_PART1/$TGT_PART2/$NODE_FILENAME"
40 chmod 664 ../images/nodes/"$TGT_PART1/$TGT_PART2/$NODE_FILENAME"
41
42 echo "[$CURRENT_DATE] Finished file processing." >> process-img.log
43 done
This page took 0.268137 seconds and 4 git commands to generate.