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