Skip to content

Instantly share code, notes, and snippets.

@mklooss
Last active November 8, 2018 06:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mklooss/6d2f52c1f4a646117341acf8523e845b to your computer and use it in GitHub Desktop.
Save mklooss/6d2f52c1f4a646117341acf8523e845b to your computer and use it in GitHub Desktop.
nginx / letsencrypt check
#!/bin/bash
sleep 10
PSAUX=$(ps aux | grep nginx | grep -v grep)
if [ -z "$PSAUX" ]; then
/etc/init.d/nginx stop
PID=$(netstat -tulnop | grep 443 | awk '{print $7}' | awk -F "/" '{print $1}' | xargs)
for p in $PID; do
echo $p
kill -9 $p
done
/etc/init.d/nginx start
fi
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
MAILTO=root
0 4,7 * * * root /usr/local/sbin/letsencrypt-update-failed.sh > /dev/null
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment