[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Monotone-commits-diffs] net.venge.monotone.contrib.usher: be2f09fb943b
From: |
code |
Subject: |
[Monotone-commits-diffs] net.venge.monotone.contrib.usher: be2f09fb943b095fc0ef79bab8742e1fa060b4e8 |
Date: |
Thu, 20 Jan 2011 10:48:14 GMT |
revision: be2f09fb943b095fc0ef79bab8742e1fa060b4e8
date: 2011-01-20T10:46:52
author: Richard Levitte <address@hidden>
branch: net.venge.monotone.contrib.usher
changelog:
Change the meaning of USHER_SYSTEM_STARTUP. The value should now be a
startup command, such as '/etc/init.d/usher'.
manifest:
format_version "1"
new_manifest [69ae84fd46560e8f1f3588682a182e08bf3aa7e3]
old_revision [1a98c248e73adeb3f2c142df260aa6c1c955d79a]
patch "utils/usherctl"
from [9e14ac83eddd623bcf86c9c2afe76c4213b3d7af]
to [9e6e3d16e444661f17a21a88b96569eb2426ba9d]
============================================================
--- utils/usherctl 9e14ac83eddd623bcf86c9c2afe76c4213b3d7af
+++ utils/usherctl 9e6e3d16e444661f17a21a88b96569eb2426ba9d
@@ -32,8 +32,16 @@ MTN=/usr/bin/mtn
#
# The following variables are only useful for the system administrator
# that wants to set up a system wide usher.
-# USHER_SYSTEM_STARTUP a non-empty string if usher should be started
-# and stopped with the script /etc/init.d/usher.
+# USHER_SYSTEM_STARTUP Usher startup command, such as "/etc/init.d/usher".
+# It MUST support the following subcommands as $1:
+# start
+# stop
+# restart
+# reload
+# status
+# (DEPRECATED: for backward compatibility, if
+# its value is "true", "/etc/init.d/usher" is
+# used)
# (default: (unset))
# USHER_USER User to run usher as. Only useful if
# usher is started with /etc/init.d/usher.
@@ -88,8 +96,22 @@ _read_pid_file () {
fi
}
+_system_init_script () {
+ case "$USHER_SYSTEM_STARTUP" in
+ true )
+ echo /etc/init.d/startup
+ ;;
+ "" )
+ ;;
+ * )
+ echo "$USHER_SYSTEM_STARTUP"
+ ;;
+ esac
+}
+
status0 () {
- if [ -z $USHER_SYSTEM_STARTUP ]; then
+ sysinit=`_system_init_script`
+ if [ -z "$sysinit" ]; then
pid=`_read_pid_file`
if [ -n "$pid" ]; then
echo "$pid"
@@ -102,7 +124,7 @@ status0 () {
return 2
fi
else
- /etc/init.d/usher status
+ $sysinit status
fi
}
status () {
@@ -127,7 +149,8 @@ start () {
}
start () {
- if [ -z $USHER_SYSTEM_STARTUP ]; then
+ sysinit=`_system_init_script`
+ if [ -z "$sysinit" ]; then
if pid=`status0`; then
echo >&2 "Usher process already up: $pid"
exit 1
@@ -136,22 +159,24 @@ start () {
$USHER -p "$USHER_PIDFILE" "$USHER_CONF" \
< /dev/null > /dev/null 2> /dev/null &
else
- /etc/init.d/usher start
+ $sysinit start
fi
}
stop () {
- if [ -z $USHER_SYSTEM_STARTUP ]; then
+ sysinit=`_system_init_script`
+ if [ -z "$sysinit" ]; then
if pid=`status0`; then
kill $pid
fi
else
- /etc/init.d/usher stop
+ $sysinit stop
fi
}
reload () {
- if [ -z $USHER_SYSTEM_STARTUP ]; then
+ sysinit=`_system_init_script`
+ if [ -z "$sysinit" ]; then
if pid=`status0`; then
kill -1 $pid
else
@@ -159,15 +184,16 @@ reload () {
exit 1
fi
else
- /etc/init.d/usher reload
+ $sysinit reload
fi
}
restart () {
- if [ -z $USHER_SYSTEM_STARTUP ]; then
+ sysinit=`_system_init_script`
+ if [ -z "$sysinit" ]; then
stop && sleep 1 && start
else
- /etc/init.d/usher restart
+ $sysinit restart
fi
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Monotone-commits-diffs] net.venge.monotone.contrib.usher: be2f09fb943b095fc0ef79bab8742e1fa060b4e8,
code <=