Merge lp:~roadmr/capomastro/init-papercuts into lp:capomastro

Proposed by Daniel Manrique
Status: Merged
Approved by: Caio Begotti
Approved revision: 200
Merged at revision: 198
Proposed branch: lp:~roadmr/capomastro/init-papercuts
Merge into: lp:capomastro
Diff against target: 36 lines (+8/-7)
1 file modified
debian/capomastro.init (+8/-7)
To merge this branch: bzr merge lp:~roadmr/capomastro/init-papercuts
Reviewer Review Type Date Requested Status
Caio Begotti (community) Approve
Review via email: mp+261453@code.launchpad.net

Commit message

Return proper error codes in the initscript. Invoke start-stop-daemon with proper PID.

Description of the change

Fixes for two tiny capomastro initscript bugs.

To post a comment you must log in.
Revision history for this message
Caio Begotti (caio1982) wrote :

Daniel, thanks for these changes! I marked it as Needs Fixing simply because when I was testing the changes I noticed the start command would always return 0 still spawning rogues processes because of a bogus pgrep check (pgrep actually should be checking for python2.7 not celery, but that would be stupid so it's just easier to list all processes owned by the capomastro user). Can you incorporate this diff in your branch please? Otherwise your MR looks good so thanks again :-)

=== modified file 'debian/capomastro.init'
--- debian/capomastro.init 2015-04-27 18:25:17 +0000
+++ debian/capomastro.init 2015-06-09 13:18:58 +0000
@@ -54,7 +54,7 @@

   if [ -f ${PIDFILE} ]; then
     curpid=$(cat ${PIDFILE})
- if pgrep celery | grep -q ${curpid}; then
+ if pgrep -u capomastro | grep -q ${curpid}; then
       return 0
     else
       start-stop-daemon -b --start --quiet -m --user ${NAME} --pidfile ${PIDFILE} --chuid ${NAME} --exec ${DAEMON} -- ${DAEMON_ARGS} || return 2

review: Needs Fixing
lp:~roadmr/capomastro/init-papercuts updated
200. By Daniel Manrique

Fix pgrep so do_start doesn't spawn rogue processes

Revision history for this message
Daniel Manrique (roadmr) wrote :

I added your patch and this is ready for another review.

Revision history for this message
Caio Begotti (caio1982) wrote :

Thanks :-D

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/capomastro.init'
2--- debian/capomastro.init 2015-04-27 18:25:17 +0000
3+++ debian/capomastro.init 2015-06-09 13:45:18 +0000
4@@ -54,7 +54,7 @@
5
6 if [ -f ${PIDFILE} ]; then
7 curpid=$(cat ${PIDFILE})
8- if pgrep celery | grep -q ${curpid}; then
9+ if pgrep -u capomastro | grep -q ${curpid}; then
10 return 0
11 else
12 start-stop-daemon -b --start --quiet -m --user ${NAME} --pidfile ${PIDFILE} --chuid ${NAME} --exec ${DAEMON} -- ${DAEMON_ARGS} || return 2
13@@ -78,16 +78,17 @@
14
15 do_check () {
16 ${DAEMON} -A ${NAME} ${*}
17-
18- [ "${?}" = 2 ] && return 2
19- return "${?}"
20+ retval=${?}
21+ [ "${retval}" = 2 ] && return 2
22+ return "${retval}"
23 }
24
25 do_status () {
26- status_of_proc "${DAEMON}" "Service ${NAME}"
27+ status_of_proc -p ${PIDFILE} "${DAEMON}" "Service ${NAME}"
28+ retval=${?}
29
30- [ "${?}" = 2 ] && return 2
31- return "${?}"
32+ [ "${retval}" = 2 ] && return 2
33+ return "${retval}"
34 }
35
36 case "${1}" in

Subscribers

People subscribed via source and target branches