Author: tmckay
Date: 2011-01-18 20:51:52 +0000 (Tue, 18 Jan 2011)
New Revision: 4474
Added:
branches/multiples/cumin/bin/cumin
Removed:
branches/multiples/cumin/bin/cumin
branches/multiples/cumin/bin/cumin-master
Modified:
branches/multiples/cumin/etc/sysvinit-cumin
Log:
Adjust init.d script for cumin, replace /usr/bin/cumin with
what was /usr/bin/cumin-master (recently added)
Deleted: branches/multiples/cumin/bin/cumin
===================================================================
--- branches/multiples/cumin/bin/cumin 2011-01-17 20:35:28 UTC (rev 4473)
+++ branches/multiples/cumin/bin/cumin 2011-01-18 20:51:52 UTC (rev 4474)
@@ -1,32 +0,0 @@
-#!/bin/bash
-
-function die {
- kill "$data" "$web"
-}
-
-trap die EXIT
-
-function start_data {
- cumin-data &
- data="$!"
-}
-
-function start_web {
- cumin-web &
- web="$!"
-}
-
-start_data
-start_web
-
-while [ 0 ]; do
- sleep 30
-
- if [ ! -d "/proc/$data" ]; then
- start_data
- fi
-
- if [ ! -d "/proc/$web" ]; then
- start_web
- fi
-done
Copied: branches/multiples/cumin/bin/cumin (from rev 4473,
branches/multiples/cumin/bin/cumin-master)
===================================================================
--- branches/multiples/cumin/bin/cumin (rev 0)
+++ branches/multiples/cumin/bin/cumin 2011-01-18 20:51:52 UTC (rev 4474)
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+from optparse import OptionParser
+from time import sleep
+import subprocess
+import os
+import sys
+import signal
+
+def call_sys_exit(sig,frame):
+ sys.exit()
+
+def set_exit_handler(func):
+ if os.name == "nt":
+ try:
+ import win32api
+ win32api.SetConsoleCtrlHandler(func, True)
+ except ImportError:
+ version = ".".join(map(str, sys.version_info[:2]))
+ raise Exception("pywin32 not installed for Python " + version)
+ else:
+ signal.signal(signal.SIGTERM, func)
+
+def main():
+
+ # tuple indices, for clarity
+ PROCESS = 0
+ SECTION = 1
+ PROGRAM = 2
+
+ parser = OptionParser()
+
+ parser.add_option("--webs", dest="webs",
default="web",
+ help="Configuration section names for cumin-web
instances."\
+ "\nEach value implies a separate cumin-web
instance.")
+
+ parser.add_option("--datas", dest="datas",
default="data",
+ help="Configuration section names for cumin-data
instances."\
+ "\nEach value implies a separate cumin-data
instance.")
+
+ (options, args) = parser.parse_args()
+
+ # Get our list cumin-web and data instances
+ # create list elements to hold the process object, section arg, and app
+ apps = []
+ for app in options.webs.split(','):
+ apps.append([None, app, "cumin-web"])
+
+ for app in options.datas.split(','):
+ apps.append([None, app, "cumin-data"])
+
+ # Launch and babysit
+ try:
+ while True:
+ for app in apps:
+ if not app[PROCESS] or app[PROCESS].poll():
+ arg = "--section=" + app[SECTION]
+ app[PROCESS] = subprocess.Popen([app[PROGRAM], arg])
+ sleep(30)
+
+ finally:
+ for app in apps:
+ if app[PROCESS]:
+ os.kill(app[PROCESS].pid, signal.SIGTERM)
+
+if __name__ == "__main__":
+ # This is necessary so that on a SIGTERM we can call sys.exit()
+ # and cause the finally block to be executed. Ctrl-C will
+ # run the finally block anyway.
+ set_exit_handler(call_sys_exit)
+ try:
+ main()
+ except KeyboardInterrupt:
+ pass
Deleted: branches/multiples/cumin/bin/cumin-master
===================================================================
--- branches/multiples/cumin/bin/cumin-master 2011-01-17 20:35:28 UTC (rev 4473)
+++ branches/multiples/cumin/bin/cumin-master 2011-01-18 20:51:52 UTC (rev 4474)
@@ -1,74 +0,0 @@
-#!/usr/bin/python
-
-from optparse import OptionParser
-from time import sleep
-import subprocess
-import os
-import sys
-import signal
-
-def call_sys_exit(sig,frame):
- sys.exit()
-
-def set_exit_handler(func):
- if os.name == "nt":
- try:
- import win32api
- win32api.SetConsoleCtrlHandler(func, True)
- except ImportError:
- version = ".".join(map(str, sys.version_info[:2]))
- raise Exception("pywin32 not installed for Python " + version)
- else:
- signal.signal(signal.SIGTERM, func)
-
-def main():
-
- # tuple indices, for clarity
- PROCESS = 0
- SECTION = 1
- PROGRAM = 2
-
- parser = OptionParser()
-
- parser.add_option("--webs", dest="webs",
default="web",
- help="Configuration section names for cumin-web
instances."\
- "\nEach value implies a separate cumin-web
instance.")
-
- parser.add_option("--datas", dest="datas",
default="data",
- help="Configuration section names for cumin-data
instances."\
- "\nEach value implies a separate cumin-data
instance.")
-
- (options, args) = parser.parse_args()
-
- # Get our list cumin-web and data instances
- # create list elements to hold the process object, section arg, and app
- apps = []
- for app in options.webs.split(','):
- apps.append([None, app, "cumin-web"])
-
- for app in options.datas.split(','):
- apps.append([None, app, "cumin-data"])
-
- # Launch and babysit
- try:
- while True:
- for app in apps:
- if not app[PROCESS] or app[PROCESS].poll():
- arg = "--section=" + app[SECTION]
- app[PROCESS] = subprocess.Popen([app[PROGRAM], arg])
- sleep(30)
-
- finally:
- for app in apps:
- if app[PROCESS]:
- os.kill(app[PROCESS].pid, signal.SIGTERM)
-
-if __name__ == "__main__":
- # This is necessary so that on a SIGTERM we can call sys.exit()
- # and cause the finally block to be executed. Ctrl-C will
- # run the finally block anyway.
- set_exit_handler(call_sys_exit)
- try:
- main()
- except KeyboardInterrupt:
- pass
Modified: branches/multiples/cumin/etc/sysvinit-cumin
===================================================================
--- branches/multiples/cumin/etc/sysvinit-cumin 2011-01-17 20:35:28 UTC (rev 4473)
+++ branches/multiples/cumin/etc/sysvinit-cumin 2011-01-18 20:51:52 UTC (rev 4474)
@@ -11,6 +11,9 @@
test -x /usr/bin/cumin || exit 1
test -x /usr/bin/cumin-database || exit 1
+SYSCONFIG="/etc/sysconfig/cumin"
+[ -r "$SYSCONFIG" ] && source "$SYSCONFIG"
+
cumin-database check-started &> /dev/null || {
echo "Cumin's database server is not running"
echo "Run 'cumin-database start' as root"
@@ -34,7 +37,7 @@
start() {
echo -n $"Starting cumin: "
- daemon --user cumin --check $servicename $processname \&
+ daemon --user cumin --check $servicename $processname $CUMIN_OPTIONS \&
RETVAL=$?
echo
[ $RETVAL -eq 0 ] && touch /var/lock/subsys/$servicename