summaryrefslogtreecommitdiff
path: root/network/hiawatha/rc.hiawatha
diff options
context:
space:
mode:
authorAntonio Hernández Blas <hba.nihilismus@gmail.com>2010-05-13 01:00:01 +0200
committerDavid Somero <xgizzmo@slackbuilds.org>2010-05-13 01:00:01 +0200
commitf986af338a4cfcceb99942550d1df4d049d752bd (patch)
tree54309dc28fc3b530588b32107a49b6b887ce66f7 /network/hiawatha/rc.hiawatha
parent9a16c49703edec5f2b9b8cae7ab1a76ff6241e75 (diff)
downloadslackbuilds-f986af338a4cfcceb99942550d1df4d049d752bd.tar.gz
network/hiawatha: Added to 13.0 repository
Diffstat (limited to 'network/hiawatha/rc.hiawatha')
-rw-r--r--network/hiawatha/rc.hiawatha63
1 files changed, 63 insertions, 0 deletions
diff --git a/network/hiawatha/rc.hiawatha b/network/hiawatha/rc.hiawatha
new file mode 100644
index 0000000000..1911cc3d5b
--- /dev/null
+++ b/network/hiawatha/rc.hiawatha
@@ -0,0 +1,63 @@
+#!/bin/sh
+
+# Start/stop/restart the hiawatha web server
+# Copyright (c) 2009 Antonio Hernández Blas <hba.nihilismus@gmail.com>
+
+CONF='/etc/hiawatha'
+CMMD="/usr/sbin/hiawatha -c $CONF"
+
+hiawatha_start() {
+ if [ -x /usr/sbin/hiawatha ]; then
+ if [ -d $CONF ]; then
+ PIDOF=$(pgrep -f "$CMMD")
+ if [ ! -z "$PIDOF" ]; then
+ echo "Error, hiawatha is already running."
+ else
+ echo "Starting hiawatha: $CMMD"
+ $CMMD
+ fi
+ else
+ echo "Error, directory $CONF does not exist."
+ fi
+ fi
+}
+
+hiawatha_stop() {
+ PIDOF=$(pgrep -f "$CMMD")
+ if [ -z "$PIDOF" ]; then
+ echo "Error, hiawatha is not running."
+ else
+ echo "Stoping hiawatha: kill $PIDOF"
+ kill $PIDOF
+ fi
+}
+
+hiawatha_status() {
+ PIDOF=$(pgrep -f "$CMMD")
+ if [ ! -z "$PIDOF" ]; then
+ echo "hiawatha is running."
+ else
+ echo "hiawatha is not running."
+ fi
+}
+
+case $1 in
+ start)
+ hiawatha_start
+ ;;
+ stop)
+ hiawatha_stop
+ ;;
+ restart)
+ hiawatha_stop
+ sleep 1
+ hiawatha_start
+ ;;
+ status)
+ hiawatha_status
+ ;;
+ *)
+ echo "Usage $0 {start|stop|restart|status}"
+ exit 1
+ ;;
+esac