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

Service status is not working when using init scripts #97

Merged
merged 3 commits into from
Jun 5, 2016

Conversation

jlcox1970
Copy link
Contributor

Turns out that the check for the status of the jira server was always returning a state of 'stopped'

This was due to the jps task always having an exit status of 1 even thou the jira service was running.
have chaged this to simply look for a process owened by the jira user

… returning a state of 'stopped'

This was due to the jps task always having an exit status of 1 even thou the jira service was running.
 have chaged this to simply look for a process owened by the jira user
ps -ef |grep $SERVICE |grep -v grep |awk '{ print $2 }' | <%= scope.lookupvar('jira::javahome') %>/bin/jps |grep -v Jps |grep -v grep > /dev/null
RETVAL=$?
if [ $RETVAL -eq 0 ];then
RETVAL=`ps -ef |grep $SERVICE |grep -v grep |grep atlassian-jira |grep ^<%= scope.lookupvar('jira::user')%> |wc -l`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this line could just be:

RETVAL=`pgrep -u <%= scope.lookupvar('jira::user')%>  -f atlassian-jira`

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

come to think of it, this whole set of cascaded ifs could be that line…

@jyaworski
Copy link
Member

Hello:

What's the status of this PR?

@bastelfreak
Copy link
Member

HI @jlcox1970, could you take a look at the improvements @igalic mentioned?

jlcox1970 added 2 commits June 6, 2016 08:48
Also shrink it down so that we run one pgrep to find the task or set it to 0
Also shrink it down so that we run one pgrep to find the task or set it to 0 - Accidental typo in function
@jlcox1970
Copy link
Contributor Author

@bastelfreak I have made some more changes in line of what @igalic was suggesting
My testing shows that it is working as before but the code I think is much cleaner

@bastelfreak
Copy link
Member

thanks!

@bastelfreak bastelfreak merged commit 3431c9d into voxpupuli:master Jun 5, 2016
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

Successfully merging this pull request may close these issues.

4 participants