Greetings!

Please review the pull request #29: (#7405) Daemonized redhat init script for dashboard opened by (haus)

Some more information about the pull request:

  • Opened: Wed Sep 14 23:33:39 UTC 2011
  • Based on: puppetlabs:1.2rc (2d92f0f2e9440b082fbafe7e4696d39b3f7fd2da)
  • Requested merge: haus:ticket/7405 (0e81c2554df5fb4a9e54465a7c505ca5998ce628)

Description:

The previous redhat init script would not daemonize, but would merely
background the dashboard server start, so running start over ssh would hang.
This patch replaces the 'su -c' with daemon and passes -d to the server start
command, so it daemonizes. Start can now be run over ssh without the hang.

Signed-off-by: Matthaus Litteken [email protected]

Thanks!
The Pull Request Bot

Diff follows:

diff --git a/ext/packaging/redhat/puppet-dashboard.init b/ext/packaging/redhat/puppet-dashboard.init
index 3ccacb8..0e7f57e 100644
--- a/ext/packaging/redhat/puppet-dashboard.init
+++ b/ext/packaging/redhat/puppet-dashboard.init
@@ -39,13 +39,12 @@ start() {
             return 0
         fi
 
-        # This is a dirty, dirty hack, but it's rather difficult to get
-        # script/server to daemonize in any way, and still give us useful
-        # debugging output (or a real exit code) if it fails to start.
-        # Also: We don't have reliable access to start-stop-daemon.
+        # This is a no longer a dirty, dirty hack, we now daemonize the server.
+        # Also: We have access to daemon.
+        daemon --user ${DASHBOARD_USER} --pidfile ${PIDFILE} "${DASHBOARD_RUBY} ${DASHBOARD_HOME}/script/server -e ${DASHBOARD_ENVIRONMENT} -p ${DASHBOARD_PORT} -b ${DASHBOARD_IFACE} -d"
 
-        su -s /bin/sh -c "${DASHBOARD_RUBY} ${DASHBOARD_HOME}/script/server -e ${DASHBOARD_ENVIRONMENT} -p ${DASHBOARD_PORT} -b ${DASHBOARD_IFACE}" ${DASHBOARD_USER} &
-        local PID=$!
+        # Grab the pid. pidof doesn't work well here, so we use pgrep
+        local PID=`pgrep -f "${DASHBOARD_RUBY} ${DASHBOARD_HOME}/script/server -e ${DASHBOARD_ENVIRONMENT} -p ${DASHBOARD_PORT} -b ${DASHBOARD_IFACE} -d"`
         echo $PID > ${PIDFILE}
 
         sleep 5

    

--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to [email protected].
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to