#48144 Add /usr/sbin/status-dirsrv script to get the status of the directory server instance.
Closed: wontfix None Opened 5 years ago by amsharma.

Currently, we have these scripts ::
/usr/sbin/start-dirsrv
/usr/sbin/stop-dirsrv
/usr/sbin/restart-dirsrv

It is good to have status-dirsrv script which can give current status of directory server that is it started or stopped.


Looks like status_instance() always returns 1, is that correct?

Replying to [comment:4 mreynolds]:

Looks like status_instance() always returns 1, is that correct?
A very good point... That's not right. I'm replacing the patch...

Here's the exit value from the revised code.

status-dirsrv

status-dirsrv <existing-instance>

echo $?

0

status-dirsrv bogus

echo $?

1

Can we return a different code for bogus?

This will let us call this and make decisions about if a server:

  • Exists and is running
  • Exists and in stopped
  • Does not exist.

Replying to [comment:8 firstyear]:

Can we return a different code for bogus?

This will let us call this and make decisions about if a server:

  • Exists and is running
  • Exists and in stopped
  • Does not exist.

Are there any standard we should follow?

git patch file (master) -- revised following the comments by William in #comment:8
0001-Ticket-48144-Add-usr-sbin-status-dirsrv-script-to-ge.patch

{{{
$ man status-dirsrv
[...]
EXIST STATUS
status-dirsrv returns 0 if all Directory Server instances are running. Otherwise, a non-
zero failure code returned from systemctl is returned.

If a single Directory Server instance is specified, 0 is returned if the instance is run‐
ning; a non-zero failure code returned from systemctl is returned if the instance is not
running; 255 is returned if the instance does not exist.
}}}

Reviewed by Mark and William (Thank you!!)

Pushed to master:
5e689f8..68659b6 master -> master
commit 44333d1
commit 68659b6

Sorry, additional push:
68659b6..6566d89 master -> master
commit 6566d89

Grammatical error in man page:

{{{
represents the number of server instance which is not running.
}}}

It should be:
{{{
represents the number of server instances which are not running.
}}}

Otherwise, ack

git patch file (master) -- additional enhancement for the exit code; revised the grammatical error in man page.
0001-Ticket-48144-Add-usr-sbin-status-dirsrv-script-to-ge.2.patch

Thank you so much, Mark! Fixed the man page.

Thanks to Mark for reviewing the patch.

Pushed to master:
347b3fe..6ec814a master -> master
commit 6ec814a

Viktor's proposal is reviewed and pushed to master:
f983a59..a8b07cd master -> master
commit a8b07cd

Metadata Update from @nhosoi:
- Issue assigned to nhosoi
- Issue set to the milestone: 1.3.5.0

3 years ago

389-ds-base is moving from Pagure to Github. This means that new issues and pull requests
will be accepted only in 389-ds-base's github repository.

This issue has been cloned to Github and is available here:
- https://github.com/389ds/389-ds-base/issues/1475

If you want to receive further updates on the issue, please navigate to the github issue
and click on subscribe button.

Thank you for understanding. We apologize for all inconvenience.

Metadata Update from @spichugi:
- Issue close_status updated to: wontfix (was: Fixed)

6 days ago

Login to comment on this ticket.

Metadata