Skip to content

Instantly share code, notes, and snippets.

@hplc
Created June 13, 2017 12:13
Show Gist options
  • Save hplc/53b5da26b2d804af3e6ac2cb3bdd5d44 to your computer and use it in GitHub Desktop.
Save hplc/53b5da26b2d804af3e6ac2cb3bdd5d44 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
@M33FT
Copy link

M33FT commented Mar 5, 2021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment