Assume you are ssh'd into a machine, and you upgrade sshd or alter the config, or whatever. You type: /etc/init.d/sshd restart You get an OK, and then !! Eeek! If fact, you can't *get* /etc/init.d/sshd to start again! Just how, exactly, is one supposed to properly use init scripts for sshd remotely?
Reason is that sshd do not stop cleanly after update of binary. You usually have to manually go "killall sshd && /etc/init.d/sshd zap start" after the stop/restart. Guess you can add this in a script and run it with "nohup" ?
can this be incorporated into the default init.d/sshd script so that it "just works"?
I'm curious as to why this differs from every other Linux distribution I've ever used. Debian has *seamless* sshd updates/upgrades, and so does RedHat. Additionally, despite the fact that I'm sure your proposed solution would work, I find that it requires too much knowledge specific to Gentoo to pull off.
Actually this is Azarah solution :) start() { checkconfig || return 1 ebegin "Starting sshd" start-stop-daemon --start --quiet --exec /usr/sbin/sshd start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid --startas /usr/sbin/sshd eend $? } It's been tested on my server :)
*** Bug 1120 has been marked as a duplicate of this bug. ***
Fixed. Remerge -r1.
Just for posterity sake: The original init file called: start-stop-daemon --start --quiet --exec /usr/sbin/sshd The new one calls: start-stop-daemon --start --quiet --pidfile /var/run/sshd.pid \ --startas /usr/sbin/sshd Cool!