Last active
October 2, 2015 17:47
-
-
Save mrngm/2287336 to your computer and use it in GitHub Desktop.
Indexer
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ cat indexer_nyamsas.sh | |
#!/bin/bash | |
if [ -r /home/mrngm/nyamsas_mount/index.gz ]; then | |
if [ -r /home/mrngm/nsas_idx ]; then | |
while true; do | |
DIFF=`zcat /home/mrngm/nyamsas_mount/index.gz | diff - /home/mrngm/nsas_idx | grep -i '<' > /tmp/tmp_idx_nyamsas` | |
STAT=$? | |
if [[ "$STAT" -eq "0" ]]; then | |
while read -r line; do | |
U=`echo $line | cut -d / -f 2` | |
# if [ "$U" == "archive" ]; then | |
# break | |
# fi | |
F=`echo $line | cut -d / -f 3-` | |
FP=`echo $F | grep -i filepart` | |
FPS=$? | |
if [[ "$FPS" -eq "0" ]]; then | |
break | |
fi | |
echo "${U} uploaded ${F} to nyamsas" | |
echo "${U} uploaded ${F} to nyamsas" | nc -uw 1 88.198.13.144 65424 | |
done </tmp/tmp_idx_nyamsas | |
zcat /home/mrngm/nyamsas_mount/index.gz > /home/mrngm/nsas_idx | |
rm /tmp/tmp_idx_nyamsas | |
fi | |
sleep 60 | |
done | |
else | |
cp /home/mrngm/nyamsas_mount/index /home/mrngm/nsas_idx | |
fi | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment