#!/bin/zsh # shot.sh TIME OUTFILE SLOT -- one headless screenshot of page.html at TIME. Needs CHROME (path to a Chromium-family browser). L=${0:A:h} [[ -x "$CHROME" ]] || { echo "CHROME is not set to an executable browser; find one and export CHROME first" >&2; exit 2; } "$CHROME" --headless --disable-gpu --hide-scrollbars --force-device-scale-factor=1 --window-size=1080,1920 \ --allow-file-access-from-files --user-data-dir=$L/work/profile$3 --screenshot="$2" "file://$L/page.html#t=$1" >/dev/null 2>&1 & p=$!; for k in {1..30}; do kill -0 $p 2>/dev/null && sleep 0.5 || exit 0; done kill $p; echo "browser hung at t=$1" >&2; exit 1