summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDmitry Bogatov <KAction@debian.org>2018-11-15 15:59:16 +0000
committerDmitry Bogatov <KAction@debian.org>2018-11-15 15:59:16 +0000
commitf8fad52c70a50762444785c2cfdbf617d288684e (patch)
tree070222655bc999c7c39519114ab2436931276463 /scripts
Import Upstream version 1.19
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/500.mini_httpd-rotate17
-rwxr-xr-xscripts/mini_httpd.sh25
-rwxr-xr-xscripts/mini_httpd_wrapper21
3 files changed, 63 insertions, 0 deletions
diff --git a/scripts/500.mini_httpd-rotate b/scripts/500.mini_httpd-rotate
new file mode 100755
index 0000000..5af4573
--- /dev/null
+++ b/scripts/500.mini_httpd-rotate
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# mini_httpd-rotate - nightly script to rotate mini_httpd's log files on FreeBSD
+#
+# This goes in /etc/periodic/daily. It rotates the log files and then
+# tells mini_httpd to re-open its log file.
+
+cd /usr/local/www/chroot/logs
+rm -f mini_httpd_log.7
+mv mini_httpd_log.6 mini_httpd_log.7
+mv mini_httpd_log.5 mini_httpd_log.6
+mv mini_httpd_log.4 mini_httpd_log.5
+mv mini_httpd_log.3 mini_httpd_log.4
+mv mini_httpd_log.2 mini_httpd_log.3
+mv mini_httpd_log.1 mini_httpd_log.2
+mv mini_httpd_log mini_httpd_log.1
+kill -HUP `cat /var/run/mini_httpd.pid`
diff --git a/scripts/mini_httpd.sh b/scripts/mini_httpd.sh
new file mode 100755
index 0000000..0dde12e
--- /dev/null
+++ b/scripts/mini_httpd.sh
@@ -0,0 +1,25 @@
+#!/bin/sh
+#
+# mini_httpd.sh - startup script for mini_httpd on FreeBSD
+#
+# This goes in /usr/local/etc/rc.d and gets run at boot-time.
+
+case "$1" in
+
+ start)
+ if [ -x /usr/local/sbin/mini_httpd_wrapper ] ; then
+ echo -n " mini_httpd"
+ /usr/local/sbin/mini_httpd_wrapper &
+ fi
+ ;;
+
+ stop)
+ kill -USR1 `cat /var/run/mini_httpd.pid`
+ ;;
+
+ *)
+ echo "usage: $0 { start | stop }" >&2
+ exit 1
+ ;;
+
+esac
diff --git a/scripts/mini_httpd_wrapper b/scripts/mini_httpd_wrapper
new file mode 100755
index 0000000..d197d79
--- /dev/null
+++ b/scripts/mini_httpd_wrapper
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# mini_httpd_wrapper - wrapper script for mini_httpd on FreeBSD
+#
+# This goes in /usr/local/sbin. It 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