Skip to content
This repository

Fixing RedHat init script (PIDFILE and status) #26

Merged
merged 1 commit into from about 1 year ago

2 participants

Felipe Salum Richard Pijnenburg
Felipe Salum
  • Fixing the exit code for the status check.
  • Adding sleep before pgrep for pid, in some cases process does not show
  • up too fast.
  • Replacing $DAEMON by $JAVA
Felipe Salum Fixing RedHat init script
* Fixing the exit code for the status check.
* Adding sleep before pgrep for pid, in some cases process does not show
* up too fast.
* Replacing $DAEMON by $JAVA
e1aa21b
Richard Pijnenburg
Owner

Thanks for the PR :-)
Will include these changes in the RPM package as well.

Richard Pijnenburg electrical merged commit 78552a1 into from March 25, 2013
Richard Pijnenburg electrical closed this March 25, 2013
dan phrawzty referenced this pull request from a commit in phrawzty/puppet-logstash January 28, 2014
dan Massage wording a little
Following @igalic's advice in issue #26, I've changed some of the wording to make it more friendly.
d643a84
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Showing 1 unique commit by 1 author.

Mar 25, 2013
Felipe Salum Fixing RedHat init script
* Fixing the exit code for the status check.
* Adding sleep before pgrep for pid, in some cases process does not show
* up too fast.
* Replacing $DAEMON by $JAVA
e1aa21b
This page is out of date. Refresh to see the latest.
9  templates/etc/init.d/logstash.init.RedHat.erb
@@ -101,7 +101,7 @@ do_start()
101 101
   fi
102 102
 
103 103
   if ! test -e "${JAR}"; then
104  
-    echo "Daemon $DAEMON doesn't exist"
  104
+    echo "Daemon $JAR doesn't exist"
105 105
     exit 1
106 106
   fi
107 107
 
@@ -116,7 +116,9 @@ do_start()
116 116
   $JAVA $ARGS > /dev/null 1>&1 &
117 117
 
118 118
   RETVAL=$?
119  
-  local PID=`pgrep -f "${DAEMON} ${ARGS}"`
  119
+  # sleeping otherwise there is not enough time to show up
  120
+  sleep 2
  121
+  local PID=`pgrep -f "${JAVA} ${ARGS}"`
120 122
   echo $PID > $PID_FILE
121 123
   success
122 124
 }
@@ -126,7 +128,7 @@ do_start()
126 128
 #
127 129
 do_stop()
128 130
 {
129  
-    killproc -p $PID_FILE $DAEMON
  131
+    killproc -p $PID_FILE $JAVA
130 132
     RETVAL=$?
131 133
     echo
132 134
     [ $RETVAL = 0 ] && rm -f ${PID_FILE}
@@ -151,6 +153,7 @@ case "$1" in
151 153
   status)
152 154
     echo -n "$DESC"
153 155
     status -p $PID_FILE
  156
+    exit $?
154 157
     ;;
155 158
   *)
156 159
     echo "Usage: $SCRIPTNAME {start|stop|status|restart}" >&2
Commit_comment_tip

Tip: You can add notes to lines in a file. Hover to the left of a line to make a note

Something went wrong with that request. Please try again.