init script should not only depend on lockfile
|Icinga Version:||OS Version:|
there are several states and action which lead into wrong information or don't do what they should in special cases.
state: icinga running
- icinga status
state: icinga not running, icinga.lock file there
=> show faulty icinga running => should check against ps
state: icinga stopped, lock file already there
- icinga start
=> icinga already running => that is wrong!
state: icinga running
- 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
- 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
#4 Updated by hbaecker almost 6 years ago
- File daemon-init.diff added
Following Note was added by Hiren on icinga-devel list:
Could someone give it a try?
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.
#5 Updated by dnsmichi almost 6 years ago
$ 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?
#6 Updated by Meier almost 6 years ago
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:
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.
#9 Updated by dnsmichi over 5 years ago
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.