Problem with reloading / SIGHUP some services
Hi there! I just realized that i.e. dovecot and exim /etc/rc.d start/stop scripts' reload function doesn't work over here on CRUX-2.4, bash 3.2.33(1). I had to use the /bin/kill binary, otherwise, I get: $ ./exim reload ./exim: line 19: kill: SIGHUP: invalid signal specification My bash's internal `kill` doesn't seem to recognize SIGHUP. Can you please verify?! The following patches work around the problem, but I want to understand whether this behaviour is expected or erratic. Thank you! Clemens -- $ diff -Nurp /etc/rc.d/dovecot~ /etc/rc.d/dovecot --- /etc/rc.d/dovecot~ 2008-01-03 23:02:03.000000000 +0100 +++ /etc/rc.d/dovecot 2008-02-17 21:10:53.000000000 +0100 @@ -22,7 +22,7 @@ restart) $0 start ;; reload) - kill -s SIGHUP $(pidof dovecot) + /bin/kill -s SIGHUP $(pidof dovecot) ;; *) echo "usage: $0 [start|stop|restart|reload]" $ diff -Nurp /etc/rc.d/exim~ /etc/rc.d/exim --- /etc/rc.d/exim~ 2008-02-17 21:09:24.000000000 +0100 +++ /etc/rc.d/exim 2008-02-17 21:10:17.000000000 +0100 @@ -16,7 +16,7 @@ restart) $0 start ;; reload) - kill -s SIGHUP `pidof exim` + /bin/kill -s SIGHUP `pidof exim` ;; *) echo "usage: $0 [start|stop|restart|reload]"
El Dom 17 Feb 2008, Clemens Koller escribió:
Hi there!
I just realized that i.e. dovecot and exim /etc/rc.d start/stop scripts' reload function doesn't work over here on CRUX-2.4, bash 3.2.33(1).
I had to use the /bin/kill binary, otherwise, I get:
$ ./exim reload ./exim: line 19: kill: SIGHUP: invalid signal specification
My bash's internal `kill` doesn't seem to recognize SIGHUP. Can you please verify?! The following patches work around the problem, but I want to understand whether this behaviour is expected or erratic.
You are not using bash, bash's builtin kill does accept SIGHUP. There are many scripts in CRUX that need this kind of correction, scripts that use #!/bin/sh should not use bash specific features. -- Alan
Alan Mizrahi schrieb:
El Dom 17 Feb 2008, Clemens Koller escribió:
Hi there!
I just realized that i.e. dovecot and exim /etc/rc.d start/stop scripts' reload function doesn't work over here on CRUX-2.4, bash 3.2.33(1).
I had to use the /bin/kill binary, otherwise, I get:
$ ./exim reload ./exim: line 19: kill: SIGHUP: invalid signal specification
My bash's internal `kill` doesn't seem to recognize SIGHUP. Can you please verify?! The following patches work around the problem, but I want to understand whether this behaviour is expected or erratic.
You are not using bash, bash's builtin kill does accept SIGHUP.
Well, good hint, but I don't think so: $ which sh /bin/sh $ ls -la /bin/sh lrwxrwxrwx 1 root root 4 Jan 4 20:57 /bin/sh -> bash $ /bin/sh --version GNU bash, version 3.2.33(1)-release (i686-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc.
There are many scripts in CRUX that need this kind of correction, scripts that use #!/bin/sh should not use bash specific features.
Ack. But I still can't see how I am _not_ using bash in above scripts. Is bash turning on some "sh" compatibility mode triggered by #!/bin/sh which can lead to the mentioned symptom? Am I blind? Regards, Clemens
On Sun, Feb 17, 2008 at 10:41:12PM +0100, Clemens Koller wrote:
Alan Mizrahi schrieb:
El Dom 17 Feb 2008, Clemens Koller escribió:
Hi there!
I just realized that i.e. dovecot and exim /etc/rc.d start/stop scripts' reload function doesn't work over here on CRUX-2.4, bash 3.2.33(1).
I had to use the /bin/kill binary, otherwise, I get:
$ ./exim reload ./exim: line 19: kill: SIGHUP: invalid signal specification
My bash's internal `kill` doesn't seem to recognize SIGHUP. Can you please verify?! The following patches work around the problem, but I want to understand whether this behaviour is expected or erratic.
You are not using bash, bash's builtin kill does accept SIGHUP.
Well, good hint, but I don't think so:
$ which sh /bin/sh
$ ls -la /bin/sh lrwxrwxrwx 1 root root 4 Jan 4 20:57 /bin/sh -> bash
$ /bin/sh --version GNU bash, version 3.2.33(1)-release (i686-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc.
There are many scripts in CRUX that need this kind of correction, scripts that use #!/bin/sh should not use bash specific features.
Ack. But I still can't see how I am _not_ using bash in above scripts. Is bash turning on some "sh" compatibility mode triggered by #!/bin/sh which can lead to the mentioned symptom? Am I blind?
Yes and no. Bash called as sh runs in POSIX mode. The simple fix is to replace SIGHUP with HUP in the rc scripts. Run kill -l in a bash and sh to see the difference. Greetings Juergen -- Juergen Daubert | mailto:jue@jue.li Korb, Germany | http://jue.li/crux
Juergen Daubert schrieb:
On Sun, Feb 17, 2008 at 10:41:12PM +0100, Clemens Koller wrote:
Alan Mizrahi schrieb:
El Dom 17 Feb 2008, Clemens Koller escribió:
Hi there!
I just realized that i.e. dovecot and exim /etc/rc.d start/stop scripts' reload function doesn't work over here on CRUX-2.4, bash 3.2.33(1).
I had to use the /bin/kill binary, otherwise, I get:
$ ./exim reload ./exim: line 19: kill: SIGHUP: invalid signal specification
My bash's internal `kill` doesn't seem to recognize SIGHUP. Can you please verify?! The following patches work around the problem, but I want to understand whether this behaviour is expected or erratic.
You are not using bash, bash's builtin kill does accept SIGHUP. Well, good hint, but I don't think so:
$ which sh /bin/sh
$ ls -la /bin/sh lrwxrwxrwx 1 root root 4 Jan 4 20:57 /bin/sh -> bash
$ /bin/sh --version GNU bash, version 3.2.33(1)-release (i686-pc-linux-gnu) Copyright (C) 2007 Free Software Foundation, Inc.
There are many scripts in CRUX that need this kind of correction, scripts that use #!/bin/sh should not use bash specific features. Ack. But I still can't see how I am _not_ using bash in above scripts. Is bash turning on some "sh" compatibility mode triggered by #!/bin/sh which can lead to the mentioned symptom? Am I blind?
Yes and no. Bash called as sh runs in POSIX mode. The simple fix is to replace SIGHUP with HUP in the rc scripts. Run kill -l in a bash and sh to see the difference.
Ahja... thanks for clarification! I suggest to apply patches like the one I posted to affected ports to get rid of bashism. Conclusion: $ kill -s HUP <pid> in bash POSIX mode works $ kill -s SIGHUP <pid> in bash POSIX mode doesn't work $ /bin/kill -s HUP <pid> from util-linux-ng works $ /bin/kill -s SIGHUP <pid> from util-linux-ng works Documentation: http://www.gnu.org/software/bash/manual/bashref.html#Bash-POSIX-Mode Regards, Clemens
participants (3)
-
Alan Mizrahi
-
Clemens Koller
-
Juergen Daubert