Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Individual init scripts don't restart correctly on Centos #1901

Closed
goetzk opened this issue Apr 16, 2017 · 6 comments
Closed

Individual init scripts don't restart correctly on Centos #1901

goetzk opened this issue Apr 16, 2017 · 6 comments

Comments

@goetzk
Copy link

goetzk commented Apr 16, 2017

Hi,
I had a quick look for existing issues so apologies if this has already been reported.

OS:

[root@shinken-test-centos ~]# lsb_release -a
LSB Version:	:base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch
Distributor ID:	CentOS
Description:	CentOS release 6.8 (Final)
Release:	6.8
Codename:	Final

Shinken:

[root@shinken-test-centos ~]# pip list |grep Shinken
You are using pip version 7.1.0, however version 9.0.1 is available.
You should consider upgrading via the 'pip install --upgrade pip' command.
Shinken (2.4.3)
[root@shinken-test-centos ~]# 

This is from a test run

[root@shinken-test-centos ~]# bash -x /etc/init.d/shinken-arbiter restart
+ bash -x /etc/init.d/shinken-arbiter restart
+ SHORTNAME=arbiter
+ NAME=shinken-arbiter
++ readlink -f /etc/init.d/shinken-arbiter
+ SCRIPT=/etc/rc.d/init.d/shinken-arbiter
++ dirname /etc/rc.d/init.d/shinken-arbiter
+ curdir=/etc/rc.d/init.d
+ export SHINKEN_MODULE_FILE=shinken-arbiter
+ SHINKEN_MODULE_FILE=shinken-arbiter
+ case "$1" in
+ /etc/rc.d/init.d/shinken restart arbiter
/etc/rc.d/init.d/shinken: line 67: cd: /etc/rc.d/init.d/../../var: No such file or directory
/etc/rc.d/init.d/shinken: line 68: cd: /etc/rc.d/init.d/../../etc: No such file or directory
Restarting arbiter
Doing config check
+ exit 0                                                   [  OK  ]
++ printf '\033]0;%s@%s:%s\007' root shinken-test-centos '~'

It appears to be the result of init.d being a symlink.

[root@shinken-test-centos ~]# ls -lh /etc/init.d
lrwxrwxrwx 1 root root 11 Feb 22 04:05 /etc/init.d -> rc.d/init.d

The root cause appears to be in /etc/rc.d/init.d/shinken where it has

## Default paths:
test "$BIN" || BIN=$(cd $curpath/.. && pwd)
test "$VAR" || VAR=$(cd $curpath/../../var && pwd)
test "$ETC" || ETC=$(cd $curpath/../../etc && pwd)

These paths are not defined yet when run via the arbiter, so /var and /etc/ cause errors. /bin/ succeeds by pure chance - the /bin has been left off the path so due to that bug there is no error in the test.

@magicdrums
Copy link

change line 67 and 68
From:
test "$VAR" || VAR=$(cd $curpath/../../var && pwd)
test "$ETC" || ETC=$(cd $curpath/../../etc && pwd)
To:
test "$VAR" || VAR=$(cd $curpath/../../../var && pwd)
test "$ETC" || ETC=$(cd $curpath/../../../etc && pwd)

SOLVED! Issue

@goetzk
Copy link
Author

goetzk commented Jun 1, 2017

The same init script is used on Debian systems, your fix will result in a broken init script on that platform.
The correct fix depends a lot on why things are this way.

The change was made in commit 55bb897 , from which it is reasonable to assume it is supposed to decouple the directories from /usr/local/.

55bb897#diff-c29ab6c44241bcf83345e349892e0cc6L37

I suggest that the correct fix is one or both of:

  • supply systemd units by default
  • install the init script to etc/init.d instead of etc/rc.d/init.d/; this can be managed with chkconfig for those still using says.

@magicdrums
Copy link

I do not know if the solution that applies solve on debian systems since I use centos, but if I think you should use the option of systemd or make the configuration chkconfig as they say.

@hvad
Copy link
Collaborator

hvad commented Jun 1, 2017 via email

@goetzk
Copy link
Author

goetzk commented Jun 2, 2017

@hvad do you think it would be feasible to install that init script / systemd unit on Centos by default?

@hvad
Copy link
Collaborator

hvad commented Jun 2, 2017

@goetzk that i do on rpm package.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants