[deltacloud-core/f16] Fix up the initscript and config to honor user variables.
Chris Lalancette
clalance at fedoraproject.org
Thu Sep 15 18:15:16 UTC 2011
commit a4f80c30ca3fbe8f4cb47c5e5681d78aaa1f8d73
Author: Chris Lalancette <clalance at redhat.com>
Date: Thu Sep 15 13:30:15 2011 -0400
Fix up the initscript and config to honor user variables.
Signed-off-by: Chris Lalancette <clalance at redhat.com>
deltacloud-core-config | 34 ++++++++++++++++++++--------------
deltacloud-core.init | 21 +++++++++------------
2 files changed, 29 insertions(+), 26 deletions(-)
---
diff --git a/deltacloud-core-config b/deltacloud-core-config
index cfa7ee7..51e7e7a 100644
--- a/deltacloud-core-config
+++ b/deltacloud-core-config
@@ -1,22 +1,28 @@
-# Deltacloud API configuration
+# Deltacloud API configuration
# http://deltacloud.org
-# Default port where Deltacloud API will listen on (3002)
-# You should be able to access Deltacloud API on http://localhost:PORT/api
+# Environment under which to run deltacloud-core (default: production)
+#API_ENV="production"
-PORT=3002
+# Default driver to be used (mock).
+# NOTE: Some drivers require some additional gems to be installed.
+# Please refer to http://deltacloud.org to see what gems are needed for specific
+# drivers
+#DRIVER="mock"
-# Bind to HOST address (default: localhost)
-# You can use both IP address or hostname
+# Port where deltacloud core will listen (default: localhost)
+# You should be able to access Deltacloud API on http://localhost:PORT/api
+#PORT="3002"
-HOST=localhost
+# Bind to HOST address (default: localhost)
+# You can use both IP address or hostname; use 0.0.0.0 to bind to all addresses
+#HOST="localhost"
-# Default driver to be used (EC2).
-# NOTE: Some drivers require some additional gems to be installed.
-# Please reffer to http://deltacloud.org to see what gems are needed for specific
-# drivers
+# Default user that deltacloud core will be run under (default: nobody)
+#DELTACLOUD_USER="nobody"
-DRIVER="ec2"
+# Default log file for deltacloud-core (default: /var/log/deltacloud-core/$DRIVER.log)
+#LOGFILE="/var/log/deltacloud-core/$DRIVER.log"
-# Default log file for Deltacloud API
-# LOGFILE="/var/log/deltacloud-core/ec2.log"
+# Default lock file for deltacloud-core (default: /var/lock/subsys/deltacloud-core)
+#LOCKFILE="/var/lock/subsys/deltacloud-core"
diff --git a/deltacloud-core.init b/deltacloud-core.init
index c645f38..7422c59 100644
--- a/deltacloud-core.init
+++ b/deltacloud-core.init
@@ -26,28 +26,25 @@ prog="deltacloud-core"
[ ! -d /var/log/$prog ] && mkdir -p /var/log/$prog
# You can overide these variables using /etc/sysconfig/deltacloud-core
-#
-# ENV=production|development
-# DRIVER=ec2|mock|gogrid
-#
-#
-API_ENV="${ENV:-production}"
-DRIVER="${DRIVER:-ec2}"
+API_ENV="${API_ENV:-production}"
+DRIVER="${DRIVER:-mock}"
PORT="${PORT:-3002}"
+HOST="${HOST:-localhost}"
+DELTACLOUD_USER="${DELTACLOUD_USER:-nobody}"
LOGFILE="${LOGFILE:-/var/log/$prog/$DRIVER.log}"
-lockfile="${LOCKFILE:-/var/lock/subsys/$prog }"
+LOCKFILE="${LOCKFILE:-/var/lock/subsys/$prog}"
[ -r $LOGFILE ] && chown nobody $LOGFILE
-[ -r $lockfile ] && chown nobody $lockfile
+[ -r $LOCKFILE ] && chown nobody $LOCKFILE
start() {
[ -x $exec ] || exit 5
echo -n $"Starting $prog: "
- daemon --user nobody "$exec -i $DRIVER -e $API_ENV --port $PORT >> $LOGFILE 2>&1 &"
+ daemon --user "$DELTACLOUD_USER" "$exec -i $DRIVER -e $API_ENV --port $PORT -r $HOST >> $LOGFILE 2>&1 &"
retval=$?
- if [ $retval -eq 0 ] && touch $lockfile ; then
+ if [ $retval -eq 0 ] && touch $LOCKFILE ; then
echo_success
echo
else
@@ -61,7 +58,7 @@ stop() {
echo -n $"Shutting down $prog: "
killproc deltacloudd
retval=$?
- if [ $retval -eq 0 ] && rm -f $lockfile ; then
+ if [ $retval -eq 0 ] && rm -f $LOCKFILE ; then
echo_success
echo
else
More information about the scm-commits
mailing list