Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Periodically archive GSA sites to Drive for GSA retention purposes. #336

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions pages/archive-sites.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash

set -e

function fail() {
echo $@
exit 1
}

function mirror() {
set -x
local site=$1
wget --recursive \
--directory-prefix="$PREFIX" \
--page-requisites \
--adjust-extension \
--span-hosts \
--convert-links \
--domains $site \
--no-parent https://www.$site
set +x
}

TARGET="$HOME/Google Drive/Shared drives/Cloud.gov Public/IDCDB-archive"

[ -d "$TARGET" ] || fail "Cannot access Google Drive target $TARGET"

TIMESTAMP=$(date "+%Y%m%d-%H%M")

PREFIX="$TARGET/$TIMESTAMP"
mkdir -p "$PREFIX" || fail "Unable to create the target directory $PREFIX"

#for S in cdo.gov cfo.gov paymentaccuracy.gov cio.gov coffa.gov evaluation.gov fpc.gov statspolicy.gov fcsm.gov; do
for S in cfo.gov paymentaccuracy.gov cio.gov coffa.gov evaluation.gov fpc.gov statspolicy.gov fcsm.gov; do
echo "=============="
echo "STARTING SITE: $S"
echo "=============="
sleep 1
mirror $S || echo "exit status $?, continuing"
done