Skip to content

Instantly share code, notes, and snippets.

@M33FT
Forked from hplc/monitor_ocserv.sh
Created March 5, 2021 00:32
Show Gist options
  • Save M33FT/e05fd1406b6b5eb77d74f68e88ca0c87 to your computer and use it in GitHub Desktop.
Save M33FT/e05fd1406b6b5eb77d74f68e88ca0c87 to your computer and use it in GitHub Desktop.
Monitor service and restart it if down in OpenWrt.
#!/bin/sh
# Put this script run in crond.
service=ocserv
if test $(netstat -na | grep 0.0.0.0:443 | wc -l) = 2
then
echo "$service is running!"
else
/etc/init.d/$service start
fi
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment