Skip to content

Instantly share code, notes, and snippets.

@tuklusan
Created September 15, 2016 16:51
Show Gist options
  • Save tuklusan/8249fc87b8bf8bb916d4b2b411260794 to your computer and use it in GitHub Desktop.
Save tuklusan/8249fc87b8bf8bb916d4b2b411260794 to your computer and use it in GitHub Desktop.
#!/bin/sh
#
# httpd410server Start/Stop the httpd410server daemon.
#
# chkconfig: 2345 90 60
# description: httpd410server is a minimal http server to ALWAYS return HTTP 410 (Gone)
# to client URI requests. It can thus be used as a fallback server for
# DNS redirected blacklist implementations using dnsmasq, dansguardian etc.
# and malware / attack domain lists like from emerging threats,
# yoyo etc.
# Supratim Sanyal - supratim at riseup dot net
# Copy this to /etc/init.d, chmod +x and chkconfig --add.
#
# Source function library.
. /etc/init.d/functions
PIDFILE=/var/run/httpd410server.pid
start() {
echo -n "Starting httpd410server"
if [ -f $PIDFILE ]; then
PID=`cat $PIDFILE`
echo already running: $PID
exit 2;
else
daemon --user=root --pidfile=$PIDFILE exec /usr/local/bin/httpd410server>/dev/null 2>&1 &
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/httpd410server
return $RETVAL
fi
}
stop() {
echo -n "Shutting down httpd410server"
echo
killproc httpd410server
echo
rm -f /var/lock/subsys/httpd410server
return 0
}
case "$1" in
start)
start
;;
stop)
stop
;;
status)
status httpd410server
;;
restart)
stop
start
;;
*)
echo "Usage: {start|stop|status|restart}"
exit 1
;;
esac
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment