Commit | Line | Data |
---|---|---|
b42b2bf9 H |
1 | #!/bin/sh |
2 | ||
5b9c0808 | 3 | # XXX do we even need this? |
4 | # configure_image_new could resize image itself | |
5 | ||
b42b2bf9 H |
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 | ||
bda5b036 | 11 | #cd /storage/system/www-root/kyberia.sk/process-img |
12 | ||
13 | echo "`pwd`"; >> /tmp/log1 | |
b42b2bf9 H |
14 | |
15 | PREPARED_FILES=`ls prepared/` | |
16 | CURRENT_DATE=`date` | |
17 | ||
bda5b036 | 18 | for PREPARED_FILE in "$PREPARED_FILES" |
b42b2bf9 H |
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 | ||
bda5b036 | 35 | TGT_PART1=`echo "$NODE_FILENAME" | cut -b 1` |
36 | TGT_PART2=`echo "$NODE_FILENAME" | cut -b 2` | |
b42b2bf9 | 37 | |
bda5b036 | 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" | |
b42b2bf9 H |
41 | |
42 | echo "[$CURRENT_DATE] Finished file processing." >> process-img.log | |
43 | done |