File: mini_httpd_wrapper

package info (click to toggle)
mini-httpd 1.23-1.2
  • links: PTS
  • area: main
  • in suites: stretch
  • size: 804 kB
  • ctags: 1,050
  • sloc: ansic: 3,537; sh: 214; makefile: 102
file content (24 lines) | stat: -rwxr-xr-x 685 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/bin/sh
#
# mini_httpd_wrapper - wrapper script for mini_httpd on FreeBSD
#
# This goes in /usr/local/sbin.  It backgrounds itself, and then runs
# mini_httpd in a loop.  If mini_httpd exits then the script restarts
# it automatically.
#
# The -D flag tells mini_httpd to *not* put itself into the background,
# and the -C flag tells it to get the rest of its configuration from
# the specified config file.

(
    while true ; do
	/usr/local/sbin/mini_httpd -D -C /usr/local/www/mini_httpd_config
	if [ -f /var/run/nologin ] ; then
	    exit
	fi
	sleep 10
	egrep ' mini_httpd[:\[]' /var/log/messages |
	  tail -33 |
	  mail -s "mini_httpd on `hostname` restarted" root
    done
) &