summaryrefslogtreecommitdiff
path: root/www/tclhttpd/files
diff options
context:
space:
mode:
authorSam Lawrance <lawrance@FreeBSD.org>2006-02-11 14:43:10 +0000
committerSam Lawrance <lawrance@FreeBSD.org>2006-02-11 14:43:10 +0000
commit3d301eecf9bb9e117b686829f7185a8f30ad02cc (patch)
treefc34753e0452a04f01cecb59ec475f82345bf051 /www/tclhttpd/files
parentUpdate to 1.3.25. (diff)
Out with the old rc.d script, in with the new.
PR: ports/91442 (requested by) Submitted by: Mike <mspam@hideaway.net> Approved by: mi (maintainer, timeout 4 weeks)
Diffstat (limited to 'www/tclhttpd/files')
-rw-r--r--www/tclhttpd/files/tclhttpd.sh24
-rw-r--r--www/tclhttpd/files/tclhttpd.sh.in42
2 files changed, 42 insertions, 24 deletions
diff --git a/www/tclhttpd/files/tclhttpd.sh b/www/tclhttpd/files/tclhttpd.sh
deleted file mode 100644
index 6376cb49a646..000000000000
--- a/www/tclhttpd/files/tclhttpd.sh
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-PID_FILE=/var/run/tclhttpd.pid
-case $1 in
- stop)
- if [ -e $PID_FILE ] ; then
- PID=`cat $PID_FILE`
- if kill $PID ; then
- exec rm -f $PID_FILE
- fi
- else
- echo "No $PID_FILE presenet, tclhttpd is, probably, not running" > /dev/stderr
- fi
- ;;
- ''|start)
- env LANG=C COMMAND_LINE &
- sleep 2
- if kill -0 $! ; then
- echo -n ' tclhttpd'
- echo $! > $PID_FILE
- else
- exec logger -s "tclhttpd failed to start"
- fi
- ;;
-esac
diff --git a/www/tclhttpd/files/tclhttpd.sh.in b/www/tclhttpd/files/tclhttpd.sh.in
new file mode 100644
index 000000000000..70f415371b2c
--- /dev/null
+++ b/www/tclhttpd/files/tclhttpd.sh.in
@@ -0,0 +1,42 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: tclhttpd
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: shutdown
+#
+# Add the following lines to /etc/rc.conf to enable tclhttpd:
+#
+# tclhttpd_enable (bool): Set it to "YES" to enable tclhttpd
+# Default is "NO".
+#
+# tclhttpd_flags (str): Arguments to be passed to tclhttpd.
+# Default is "".
+#
+# tclhttpd_stdout_log(str): Set to the location for the tclhttpd
+# process log (standard out)
+#
+# tclhttpd_stderr_log (str): Set to the location for the tclhttpd
+# process log (standard error)
+
+. %%RC_SUBR%%
+
+name="tclhttpd"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${tclhttpd_enable="NO"}
+: ${tclhttpd_flags=""}
+: ${tclhttpd_stdout_log="/var/log/tclhttpd-stdout.log"}
+: ${tclhttpd_stderr_log="/var/log/tclhttpd-stderr.log"}
+
+procname="%%LOCALBASE%%/bin/tclsh%%TCL_DVER%%"
+pidfile=/var/run/tclhttpd.pid
+log_args=">> ${tclhttpd_stdout_log} \
+ 2>> ${tclhttpd_stderr_log} "
+command="/usr/sbin/daemon"
+flags="-p ${pidfile} %%LOCALBASE%%/bin/tclsh%%TCL_DVER%% %%PREFIX%%/bin/httpd.tcl ${tclhttpd_flags} ${log_args}"
+
+run_rc_command "$1"