#433 multiple bugs in start-dirsrv, stop-dirsrv, restart-dirsrv scripts - with suggested fixes
Closed: Fixed None Opened 6 years ago by rmeggins.

https://bugzilla.redhat.com/show_bug.cgi?id=846787 (Fedora)

Description of problem:
The scripts:  /sbin/start-dirsrv, /sbin/stop-dirsrv, /sbin/restart-dirsrv
are broken.

- contains reasonable 10sec waits for pid, followed by broken 10 minute waits
for PIDFILE
- 10sec wait doesn't continue if it succeeds in lt 10sec
- start-dirsrv creates *.startpid file which never gets used
- start-dirsrv removes its newly created PIDFILE
- tries to start the admin server with ns-dlapd
    ( "for i in $initconfig_dir/dirsrv-*; do" matches
"/etc/sysconfig/dirsrv-admin" )
- tries to use non-existant (or non-documented) -w option on ns-dlapd


Version-Release number of selected component (if applicable):
389-ds-base-1.2.11.5-1.fc17.x86_64

How reproducible:
100%

Steps to Reproduce:
1. start-dirsrv
2. restart-dirsrv
3. stop-dirsrv

Actual results:
# start-dirsrv
Starting instance "admin"
/sbin/start-dirsrv: line 63: ./ns-slapd: No such file or directory
Starting instance "lweb1-vhost4"
There is an ns-slapd running: 2820
# restart-dirsrv
Restarting instance "admin"
No ns-slapd PID file found. Server is probably not running
/usr/sbin/start-dirsrv: line 63: ./ns-slapd: No such file or directory
Restarting instance "lweb1-vhost4"
# stop-dirsrv
Stopping instance "admin"
No ns-slapd PID file found. Server is probably not running
Stopping instance "lweb1-vhost4"
#


Expected results:
# start-dirsrv
Starting instance "lweb1-vhost4"
# restart-dirsrv
Restarting instance "lweb1-vhost4"
# stop-dirsrv
Stopping instance "lweb1-vhost4"
#

# start-dirsrv
Starting instance "lweb1-vhost4"
# start-dirsrv
Starting instance "lweb1-vhost4"
There is an ns-slapd process already running: 3164
#

# stop-dirsrv
Stopping instance "lweb1-vhost4"
# stop-dirsrv
Stopping instance "lweb1-vhost4"
No ns-slapd PID file found. Server is probably not running
#



Additional info:

Poroposed replacement scripts attached below.

Added initial screened field value.

Rewrite start-dirsrv, stop-dirsrv, etc. using systemctl.

Comments about the reported problems...

[1] 10 minute wait for the PIDFILE - this is actually necessary becuase if you have verbose error logging enabled, it can take several minutes until this file is written.

[2] The file ".startpid" is used/necessary

[3] "-w" - this is used by the server internally

The current patch just ignores "dirsrv-admin" when running the start/stop/restart scripts. Also, setup-ds.pl/setup-ds-admin.pl do not allow the use of DS instances named "admin". This prevents the admin server identifier, in /etc/sysconfig/, from being overwritten by a DS instance named "admin".

Sending patch out for review...

[mareynol@localhost ds]$ git merge ticket433
Updating ca06547..6ddfaa0
Fast-forward
ldap/admin/src/scripts/DSCreate.pm.in | 4 +++-
ldap/admin/src/scripts/DSDialogs.pm | 6 +++++-
ldap/admin/src/scripts/DSUtil.pm.in | 7 ++++++-
ldap/admin/src/scripts/restart-dirsrv.in | 4 ++++
ldap/admin/src/scripts/setup-ds.pl.in | 8 +++++++-
ldap/admin/src/scripts/setup-ds.res.in | 2 ++
ldap/admin/src/scripts/start-dirsrv.in | 4 ++++
ldap/admin/src/scripts/stop-dirsrv.in | 4 ++++
8 files changed, 35 insertions(+), 4 deletions(-)

[mareynol@localhost ds]$ git push origin master
Counting objects: 27, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (13/13), done.
Writing objects: 100% (14/14), 2.26 KiB, done.
Total 14 (delta 12), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
ca06547..6ddfaa0 master -> master

sorry I didn't review this sooner - this is wrong:
{{{
if($inf->{slapd}->{ServerIdentifier} eq "admin"){
126 return ('error_invalid_serverid - "admin" is reserved for the Admininstration Server, please choose a different server identifier');
127 } elsif (!isValidServerID($inf->{slapd}->{ServerIdentifier})) {
}}}

Line 126 should use 'error_reserved_serverid' with "admin" as the argument.

Also, in setup-ds.res.in, the definition of error_reserved_serverid:
{{{
error_reserved_serverid = The ServerIdentifier '%s" is reserved for the Administration Server, please choose a different server identifier.\n
}}}
Should use two single quotes instead of a single quote and a double quote

git merge ticket433
Updating 6ddfaa0..54112e4
Fast-forward
ldap/admin/src/scripts/DSCreate.pm.in | 2 +-
ldap/admin/src/scripts/setup-ds.res.in | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)

[mareynol@localhost ds]$ git push origin master
Counting objects: 15, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (7/7), done.
Writing objects: 100% (8/8), 795 bytes, done.
Total 8 (delta 6), reused 0 (delta 0)
To ssh://git.fedorahosted.org/git/389/ds.git
6ddfaa0..54112e4 master -> master

Metadata Update from @mreynolds:
- Issue assigned to mreynolds
- Issue set to the milestone: 1.3.1

2 years ago

Login to comment on this ticket.

Metadata