-
Notifications
You must be signed in to change notification settings - Fork 24
/
scrape.sh
executable file
·29 lines (20 loc) · 939 Bytes
/
scrape.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
#/bin/bash
# build js/css:
npm run predeploy
npm run start &
SERVER_PID=$!
rm -fR ./docs
# give the server some time to start
sleep 3
# download the site from the running server to a static copy:
wget --mirror --convert-links --adjust-extension --page-requisites --no-parent --no-host-directories --recursive --domains=localhost -P ./docs --debug http://localhost:8888
# changes to template engine since site was created mean <figure is escaped as - unescape it:
# this is just a hack to keep an archived site online 10 years after I wrote it
find docs -name "*.html" -exec sed -i '' 's/\</</g; s/\>/>/g' {} +
echo "Killing all child process...(PID $SERVER_PID - I am $$)"
ps
# kill npm processes started by this script:
ps | awk '$4 == "npm" {print $1}' | xargs kill
echo "scrape complete - you probably now want to run:"
echo " npx http-server -p 8123 ./docs"
echo " and visit http://localhost:8123 in your browser"