[dev.icinga.com #249] init script should not only depend on lockfile #108

Closed
icinga-migration opened this Issue Jan 9, 2010 · 12 comments

Projects

None yet

1 participant

@icinga-migration
Member

This issue has been migrated from Redmine: https://dev.icinga.com/issues/249

Created by mfriedrich on 2010-01-09 23:39:41 +00:00

Assignee: (none)
Status: Resolved (closed on 2010-05-21 10:25:07 +00:00)
Target Version: (none)
Last Update: 2010-05-21 10:25:06 +00:00 (in Redmine)


there are several states and action which lead into wrong information or don't do what they should in special cases.

state: icinga running

  1. icinga status
    => correct

state: icinga not running, icinga.lock file there

#icinga status
=> show faulty icinga running => should check against ps

state: icinga stopped, lock file already there

  1. icinga start
    => icinga already running => that is wrong!

state: icinga running

  1. icinga restart
    => icinga stops not in timely manner, leaves icinga.lock there, starting again fails
    => wrong output, better would be icinga did not stop in a timely manner for restarting, please try icinga stop\nicinga start\n

state: icinga running, lockfile removed

  1. icinga stop
    => Stopping icinga: No lock file found in /opt/icinga/var/icinga.lock
    => should check against ps -C icinga and issue a killall -9

Attachments

Changesets

2010-05-19 09:19:17 +00:00 by Meier 4e99d93

use redhaht init script on redhat rpm builds
fixes #387
fixes #249 on redhat

2010-05-19 09:46:36 +00:00 by Meier e290d8d

use redhat init script on redhat rpm builds
fixes #387
refs #249 on redhat

Relations:

@icinga-migration
Member

Updated by mfriedrich on 2010-01-09 23:45:07 +00:00

  • Assigned to set to hbaecker
  • Target Version set to 1.0.1
@icinga-migration
Member

Updated by Meier on 2010-01-10 09:46:43 +00:00

In ido2db init-script i used this

checkpid_ido2db() {
        local i

        for i in $* ; do
                [ -d "/proc/$i" ] && return 0
        done
        return 1
}

To check against /proc if the process with a given pid is still running.

@icinga-migration
Member

Updated by mfriedrich on 2010-01-10 21:46:13 +00:00

jep but in *bsd there is no /proc so ps -o pid -p $pid would be nice instead

@icinga-migration
Member

Updated by hbaecker on 2010-01-20 20:47:34 +00:00

  • File added daemon-init.diff

Following Note was added by Hiren on icinga-devel list:

Could someone give it a try?


  1. Message:
    looking for comments on this diff, have not tested it yet, have not setup a test environment to test with yet.
    comments on how it works and if it would be accepted welcome, if so, I'll get around to testing it and submitting fixes if there are issues.
    thanks.

@icinga-migration
Member

Updated by mfriedrich on 2010-01-31 19:24:55 +00:00

$ patch -p0 < daemon-init.diff

it behaves rather strange:

$ sudo /etc/init.d/icinga status
icinga (pid 12689) is running...
$ sudo killall -9 icinga
$ sudo /etc/init.d/icinga status
icinga is not running
$ sudo /etc/init.d/icinga stop
Stopping icinga: /etc/init.d/icinga: line 91: kill: (12689) - No such process
done.
$ sudo /etc/init.d/icinga start
Warning: bad syntax, perhaps a bogus '-'? See /usr/share/doc/procps-3.2.7/FAQ
No lock file found in /opt/icinga/var/icinga.lock
no PID file found but icinga found in ps listing
please manually kill existing icinga process

lock file is not there, but for some reason icinga is detected running (only ido2db and postgres match on ps aux | grep icinga). any ideas?

@icinga-migration
Member

Updated by Meier on 2010-02-05 12:25:53 +00:00

dnsmichi wrote:

jep but in *bsd there is no /proc so ps -o pid -p $pid would be nice instead

As I mentioned long time ago, we really might want different initscripts for different platforms:

  • redhat/fedora
  • suse
  • debian/ubuntu
  • bsd
  • Windows?

I'm not a bsd user but iirc they do not use SysV init so at least there we should go for a seperate implementation matching their startup framework.

@icinga-migration
Member

Updated by Meier on 2010-02-05 12:53:02 +00:00

I added a redhat/fedora specific init script. Currently is uses --user in the startup so only works if all necessary files belong to nagios, that avoids the "reload problem".

@icinga-migration
Member

Updated by mfriedrich on 2010-02-12 02:17:05 +00:00

  • Target Version changed from 1.0.1 to 1.0.2

needs more investigations, postponed.

@icinga-migration
Member

Updated by mfriedrich on 2010-04-21 10:58:27 +00:00

during the show-errors feature from wolfang and now in git, i also changed the behavior when icinga daemon cannot be stopped in a timely manner.

before, the 10 times retry loop failed, and an error msg was the output. afterwards, the pid/lock was removed automatically. but icinga daemon was running - so everyone needed to killall 9 icinga no this is changed into not removing that and just telling the user to try again.

imho that's a better solution regarding usability. on large environments it will happen, that stopping icinga will no be possible and doing it manually everytime is not a prefered solution.

@icinga-migration
Member

Updated by mfriedrich on 2010-05-16 16:50:22 +00:00

  • Assigned to deleted hbaecker
  • Target Version deleted 1.0.2
  • Done % changed from 0 to 80
@icinga-migration
Member

Updated by Meier on 2010-05-19 09:21:53 +00:00

for redhatish systems this is fixed in daemon-init-redhat.in

4e99d93

@icinga-migration
Member

Updated by Meier on 2010-05-21 10:25:07 +00:00

  • Status changed from New to Resolved
  • Done % changed from 80 to 100

Applied in changeset commit:"4e99d936674173cfc5673c2c9121f8a5d1386b36".

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment