-
Notifications
You must be signed in to change notification settings - Fork 1
/
stripDatesAndEvents.sh
executable file
·48 lines (28 loc) · 1.21 KB
/
stripDatesAndEvents.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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
source /home/arclight/.bash_profile
cd /home/arclight/scripts
file=/home/arclight/scripts/arclight_fileChangesSorted.txt
echo "sorting file changes"
sort -u /home/arclight/scripts/arclight_fileChanges.txt >> /home/arclight/scripts/arclight_fileChangesSorted.txt
rm /home/arclight/scripts/arclight_fileChanges.txt
echo "killing fswatch"
killall fswatch
echo "starting fswatch"
/usr/local/bin/fswatch -r -L /var/www/html/arclight/data/ead/ --event Created --event Updated >> /home/arclight/scripts/arclight_fileChanges.txt &
echo "starting indexing loop"
while read -r line
do
cd /home/arclight/arclight/
head -n 1 "$file" >> /home/arclight/scripts/processed.txt #copies first line to backup file
runthis=$(echo $line | sed -r s',^(\/.*\/(.*)\/.*)+,FILE=\1 REPOSITORY_ID=\2 bundle exec rake arclight:index,')
runthis=$(echo $runthis | sed -r s'|REPOSITORY_ID=findingaids|REPOSITORY_ID=ctdbn|')
echo "$runthis"
cd /home/arclight/arclight/
eval $runthis
echo "going back to scripts directory"
cd /home/arclight/scripts
sed -i -e "1d" $file # deletes first line
cd /home/arclight/arclight/
line=
runthis=
done < /home/arclight/scripts/arclight_fileChangesSorted.txt
echo "all done :)"