Skip to content

Return nonzero exit codes on init function failure#51

Merged
jaredmorrow merged 2 commits intomasterfrom
jem-deb-exit-codes
May 10, 2013
Merged

Return nonzero exit codes on init function failure#51
jaredmorrow merged 2 commits intomasterfrom
jem-deb-exit-codes

Conversation

@jaredmorrow
Copy link
Contributor

Addresses #40

The Debian policy is vague on "proper" exit codes, many times
going against the LSB. See http://wiki.debian.org/LSBInitScripts
for reference. This commit goes with the LSB to at least return
nonzero exit codes on start/stop/reload/restart functions.

Here is the behavior in testing

➜  init.d  sudo ./riak start
!!!!
!!!! WARNING: ulimit -n is 1024; 4096 is the recommended minimum.
!!!!
➜  init.d  echo $?
0
➜  init.d  sudo ./riak ping
pong
➜  init.d  echo $?
0
➜  init.d  sudo ./riak stop
ok
➜  init.d  echo $?
0
➜  init.d  sudo ./riak ping
Node 'riak@127.0.0.1' not responding to pings.
➜  init.d  echo $?
1
➜  init.d  sudo emacs /etc/riak/app.config # edit config here to fail
➜  init.d  head -5 /etc/riak/app.config
%% -*- mode: erlang;erlang-indent-level: 4;indent-tabs-mode: nil -*-
%% ex: ft=erlang ts=4 sw=4 et
[ parse,error,in,the,house]]]]]
 %% Riak Client APIs config
 {riak_api, [
➜  init.d  sudo ./riak ping
Node 'riak@127.0.0.1' not responding to pings.
➜  init.d  sudo ./riak start
Error on line 3: syntax error before: ']'
Error reading /etc/riak/app.config
➜  init.d  echo $?
1
➜  init.d  sudo ./riak stop
Node 'riak@127.0.0.1' not responding to pings.
Node is not running!
➜  init.d  echo $?
0
➜  init.d  sudo ./riak ping
Node 'riak@127.0.0.1' not responding to pings.
➜  init.d  echo $?
1
➜  init.d  sudo ./riak restart
 * Restarting Riak is a distributed data store riak                                                              Node 'riak@127.0.0.1' not responding to pings.
Node is not running!
Error on line 3: syntax error before: ']'
Error reading /etc/riak/app.config
➜  init.d  echo $?
0

The final return code of "0" is correct on a restart when the node isn't running to begin with.

Addresses #40

The Debian policy is vague on "proper" exit codes, many times
going against the LSB.  See http://wiki.debian.org/LSBInitScripts
for reference.  This commit goes with the LSB to at least return
nonzero exit codes on start/stop/reload/restart functions.
@jsmartin
Copy link

+1

jaredmorrow added a commit that referenced this pull request May 10, 2013
Return nonzero exit codes on init function failure
@jaredmorrow jaredmorrow merged commit 6b788bc into master May 10, 2013
@jaredmorrow jaredmorrow deleted the jem-deb-exit-codes branch May 10, 2013 20:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants