| ---------------------------------------- | |
| Mirroring on SDF | |
| March 13th, 2018 | |
| ---------------------------------------- | |
| Things from gopher.black should be mirroring properly on SDF now. | |
| I've written a script to pull the phlog regularly and update | |
| things. It checks the timestamp of my main gophermap before and | |
| after pulling. If the timestamp changed, something is new... and | |
| it touches the gopher folder to update my placement on the phlog | |
| lists. Lets see how this goes! | |
| Here's my script, in case anyone wants to duplicate the effort. | |
| Note that 'stat' on cluster is not GNU stat and has a wildly | |
| different format. Yeesh. | |
| #!/usr/bin/env bash | |
| # Config | |
| GOPHER_DIR="/ftp/pub/users/tomasino/" | |
| GOPHERMAP="${GOPHER_DIR}/gophermap" | |
| # Overrides | |
| pushd () { | |
| command pushd "$@" > /dev/null | |
| } | |
| popd () { | |
| command popd "$@" > /dev/null | |
| } | |
| # Grab timestamp of gophermap before pulling | |
| gophermap_start_time=$(stat -Lnqr "${GOPHERMAP}" | awk '{print $9}' ) | |
| # Pull the latest content silently | |
| pushd "${GOPHER_DIR}" | |
| git pull -q origin master | |
| popd | |
| # Grab timestamp of gophermap after pulling | |
| gophermap_end_time=$(stat -Lnqr "${GOPHERMAP}" | awk '{print $9}' ) | |
| # If the timestamps are different, touch the folder to trigger phlog listing | |
| if [[ "${gophermap_start_time}" != "${gophermap_end_time}" ]]; then | |
| touch "${GOPHER_DIR}" | |
| fi |