Description
At present, we touch the PID file /opt/couchbase/var/lib/couchbase/couchbase-server.pid as part of the init.d script and write to it (if I'm not mistaken) here.
However on shutdown we never clean this up, for example:
$ sudo cat /opt/couchbase/var/lib/couchbase/couchbase-server.pid
|
6459
|
|
$ ps -p 6459
|
PID TTY TIME CMD
|
6459 ? 00:00:03 beam.smp
|
|
$ sudo /etc/init.d/couchbase-server stop
|
Stopping couchbase-server
|
[ OK ]
|
$ sudo cat /opt/couchbase/var/lib/couchbase/couchbase-server.pid
|
6459
|
$ ps -p 6459
|
PID TTY TIME CMD
|
We also check the pid file as part of the init.d script:
running() {
|
pidofproc -p $PIDFILE $DAEMON >/dev/null |
errcode=$?
|
return $errcode |
}
|
|
case $1 in |
start)
|
if running ; then |
warning && echo "couchbase-server is already started" |
exit 0 |
fi |
echo -n $'Starting couchbase-server\n' |
start
|
echo |
;;
|
|
...
|
This can become a problem after a reboot if another process is now running under the previous PID, as the init.d script will return:
$ sudo /etc/init.d/couchbase-server start
|
couchbase-server is already started [WARNING]
|
In this case, I manually set the PID file to have a PID I knew would clash, but we have seen cases where this happens "organically".
Admittedly, I'm not sure what the best solution is here, but I wanted to highlight the problem.
Attachments
Issue Links
- relates to
-
MB-23939 Remove the init.d scripts on platforms that now support systemd
- Closed