Project

General

Profile

Actions

Bug #791

closed

Foreman starts itself unexpectedly as a service even when you use passenger

Added by Marcello de Sousa over 13 years ago. Updated about 6 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Category:
Packaging
Target version:
Difficulty:
Triaged:
No
Fixed in Releases:
Found in Releases:

Description

In an RPM foreman installation, logrotate will start foreman's /etc/init.d/foreman service script even when you don't want (when you run it with passenger for example).

The suggested solution is to add a "condrestart" to the startup script and modify logrotate.

Patches:
Startup script

--- a/etc/init.d/foreman        2011-03-25 14:05:24.000000000 +0100
+++ b/etc/init.d/foreman     2011-03-25 14:08:55.000000000 +0100
@@ -66,8 +66,15 @@
         stop
         start
     ;;
+    condrestart)
+        if [ -f ${FOREMAN_HOME}/tmp/pids/server.pid ]; then
+            stop
+            start
+            RETVAL=$?
+        fi
+        ;;
     *)
-        echo $"Usage: $prog {start|stop|restart}" 
+        echo $"Usage: $prog {start|stop|condrestart|restart}" 
         exit 1
 esac

Logrotate config

--- a/etc/logrotate.d/foreman    2011-03-25 14:32:28.000000000 +0100
+++ b/etc/logrotate.d/foreman    2011-03-25 14:33:26.000000000 +0100
@@ -7,6 +7,6 @@
   compress
        daily
   postrotate
-    [ -e /etc/init.d/foreman ] && /etc/init.d/foreman condrestart >/dev/null 2>&1 || true
+    [ -e /etc/init.d/foreman ] && /etc/init.d/foreman restart >/dev/null 2>&1 || true
   endscript
 }

Actions

Also available in: Atom PDF