Permalink
Browse files

Darwin /etc scripts support supplied by Eric Baur

git-svn-id: https://erlyaws.svn.sourceforge.net/svnroot/erlyaws/trunk/yaws@482 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent e6e84a0 commit 6e7055a0c3e13efa054db405032b04df96e9238b @klacke committed Aug 19, 2003
Showing with 83 additions and 0 deletions.
  1. +8 −0 scripts/Install
  2. +29 −0 scripts/darwin/README
  3. +39 −0 scripts/darwin/Yaws.StartupItem
  4. +7 −0 scripts/darwin/Yaws.plist
View
8 scripts/Install
@@ -52,6 +52,14 @@ elif [ -f /etc/suseservers ]; then
install -d ${etcdir}/init.d
sed -e "s;%prefix%;$p;g" suse/yaws.init.d > ${etcdir}/init.d/yaws
chmod +x ${etcdir}/init.d/yaws
+elif [ "`uname -s`" = "Darwin" ]; then
+ startupdir="/Library/StartupItems/Yaws"
+ if [ ! -d ${startupdir} ]; then
+ mkdir ${startupdir};
+ fi
+ sed -e "s;%prefix%;$p;g" darwin/Yaws.StartupItem > ${startupdir}/Yaws
+ chmod +x ${startupdir}/Yaws
+ cp darwin/Yaws.plist ${startupdir}/StartupParameters.plist
else
echo "Don't know how to make /etc/init scrips for this system"
echo "possibly add $1/bin/yaws -D -heart to your /etc/rc.local manually"
View
29 scripts/darwin/README
@@ -0,0 +1,29 @@
+Yaws startup on MacOS X / Darwin
+
+Doing `make install' as root will create a `Yaws' StartupItem in
+/Library/StartupItems.
+
+By default, yaws startup is disabled. To enable it, edit (as root)
+/etc/hostconfig and add the line
+
+ YAWS=-YES-
+
+Yaws startup can be disabled by changing the line to
+
+ YAWS=-NO-
+
+Yaws will start automatically on reboot. You can manually test the
+startup without rebooting by issuing the command (as root) in a
+terminal window
+
+ $ SystemStarter start Yaws
+
+
+Stop the server by issuing:
+
+ $ SystemStarter stop Yaws
+
+Reload the server with the command
+
+ $ SystemStarter restart Yaws
+
View
39 scripts/darwin/Yaws.StartupItem
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+##
+# Yaws HTTP Server
+##
+
+. /etc/rc.common
+
+yaws=%prefix%/bin/yaws
+lockdir=/var/spool/lock
+
+StartService ()
+{
+ if [ "${YAWS:=-NO-}" = "-YES-" ]; then
+ ConsoleMessage "Starting yaws http daemon"
+ HOME=/tmp $yaws -D -heart
+ RETVAL=$?
+ [ $RETVAL = 0 ] && touch ${lockdir}/yaws
+ fi
+}
+
+StopService ()
+{
+ ConsoleMessage "Stopping yaws http daemon"
+ HOME=/tmp $yaws -s
+ rm -f ${lockdir}/yaws /var/run/yaws.pid
+}
+
+RestartService ()
+{
+ if [ "${YAWS:=-NO-}" = "-YES-" ]; then
+ ConsoleMessage "Restarting yaws http daemon"
+ HOME=/tmp $yaws -h
+ else
+ StopService
+ fi
+}
+
+RunService "$1"
View
7 scripts/darwin/Yaws.plist
@@ -0,0 +1,7 @@
+{
+ Description = "Yaws web server";
+ Provides = ("Yaws");
+ Requires = ("DirectoryServices");
+ Uses = ("Disks", "NFS", "Network Time");
+ OrderPreference = "None";
+}

0 comments on commit 6e7055a

Please sign in to comment.