Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The exit code for the 'info' command always returns 0 #68

Closed
benpillet opened this issue Jul 10, 2014 · 7 comments
Closed

The exit code for the 'info' command always returns 0 #68

benpillet opened this issue Jul 10, 2014 · 7 comments

Comments

@benpillet
Copy link

In the Linux Standard Base, the exit codes are different if the service is running or not running. It would be nice to be able to check the exit code in wrapper scripts. http://refspecs.linuxbase.org/LSB_3.1.0/LSB-Core-generic/LSB-Core-generic/iniscrptact.html

@kostya
Copy link
Owner

kostya commented Jul 10, 2014

Not understand what you mean, eye already return different exit codes (from 0.6), maybe you use old version?

@benpillet
Copy link
Author

Interesting. I didn't realize that upstart doesn't follow that convention anymore. I just verified that service ntpd status always returns 0 even with ntpd not running on my ubuntu 12.04 box.

I'm using 0.6.2 from rubygems. I was expecting to see here https://github.com/kostya/eye/blob/master/lib/eye/cli.rb#L22 something like:
if(something_not_started(res))
exit(1)
end

When I run eye status myservice; echo $? I always get 0, even when the service is stopped. I hacked around it in the /etc/init.d/myservice script I'm wrapping eye with, but other's are expecting eye to return "not 0" https://github.com/hamann/eye-chef-cookbook/blob/master/providers/service.rb#L153
Does that make more sense?

@kostya
Copy link
Owner

kostya commented Jul 11, 2014

still not understand:

eye$ bundle exec eye i sample1; echo $?
sample1 ........................... up  (00:42, 0%, 46Mb, <13251>)

0
eye$ bundle exec eye i sample144; echo $?
command :info, objects not found!
1
eye$ bundle exec eye q; echo $?
Quit ಠ╭╮ಠ
0
eye$ bundle exec eye i sample144; echo $?
socket(/home/kostya/.eye/sock) not found, did you run `eye load`?
1

@kostya
Copy link
Owner

kostya commented Jul 11, 2014

if you want to get 0 or 1 if process up or down, there is no such method.
if it needed i think this can be implemented

@benpillet
Copy link
Author

I think it would be useful for compatibility. Would you like me to put something together and submit a pull request or do you want to tackle it?

@kostya kostya closed this as completed in f63fed6 Jul 11, 2014
@kostya
Copy link
Owner

kostya commented Jul 11, 2014

can you test it? i am used correct statuses?

@benpillet
Copy link
Author

Yes. Looks good. Thanks for the quick response 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants