#!/bin/bash # Stop webroot web server used for certbot renewal me=$(basename "$0") dir=/var/lib/letsencrypt/tmpwww for f in $dir/certbot-webroot-*.pid; do logger -t "$me" "Stopping server with pid in $f" kill $(< "$f") && rm "$f" # or?: # kill $(ps ax | grep '[p]ython3 -m http.server' | awk '{print $1}') done