-
Notifications
You must be signed in to change notification settings - Fork 28
/
update.sh
executable file
·34 lines (25 loc) · 899 Bytes
/
update.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/bin/sh
DATE=`date -u +"%Y-%m-%dT%H:%M:%SZ"`
DEST="index_$DATE.jar"
# Download scripts
cd /Users/steve/greasefire
java -jar greasefire/java/greasefire-scraper/downloadscripts.jar scripts $1
# Generate indexes into tmp
mkdir tmp
java -Xmx512m -jar greasefire/java/greasefire-scraper/generateindex.jar scripts tmp
# Jar up indexes
cd tmp
echo "[indexes]" > info.ini
echo "date=$DATE" >> info.ini
jar cvfM $DEST include.dat exclude.dat scripts.db info.ini
mkdir $DATE
cp include.png exclude.png $DATE
# Copy indexes to skrul.com
scp -r ./$DEST ./$DATE [email protected]:skrul.com/projects/greasefire/indexes
# Clean up tmp
cd ..
rm -r tmp
# Update latest file on skrul.com
ssh [email protected] "echo $DATE > skrul.com/projects/greasefire/indexes/latest"
# Delete indexes older than a week
ssh [email protected] "find skrul.com/projects/greasefire/indexes/index_* -type f -mtime 7 -exec rm {} \;"