Re: [arch-general] [arch-dev-public] [signoff] openssh 5.4p1-2
On Wed, Mar 10, 2010 at 05:16:10PM +0100, Pierre Schmitz wrote:
Am Mittwoch, 10. März 2010 17:08:45 schrieb Pierre Schmitz:
Am Mittwoch, 10. März 2010 16:36:15 schrieb Pierre Schmitz: This is really not my day and I already regret touching this package. :-) The problem with using readlink /proc/$pid/exe is that during an update of a running sshd that link will point nowhere. As a result the restart will fail.
What do you think about using /proc/$pid/cmdline instead?
Just found out that this wont work with ssh_args set in /ec/conf.d/sshd. My last resort would be stripping that possible "(deleted)" fro mthe readlink output.
Here's another way to check if the pid file is valid: if pidof sshd | grep -q $(cat /var/run/sshd.pid); then echo "pid in /var/run/sshd.pid is valid" else echo "invalid pid" fi -- Byron Clark
On Wed, Mar 10, 2010 at 09:32:15AM -0700, Byron Clark wrote:
if pidof sshd | grep -q $(cat /var/run/sshd.pid); then echo "pid in /var/run/sshd.pid is valid" else echo "invalid pid" fi
Ignore that, it isn't entirely safe. -- Byron Clark
Byron Clark wrote:
On Wed, Mar 10, 2010 at 09:32:15AM -0700, Byron Clark wrote:
if pidof sshd | grep -q $(cat /var/run/sshd.pid); then echo "pid in /var/run/sshd.pid is valid" else echo "invalid pid" fi
Ignore that, it isn't entirely safe.
You may want grep -q "^$(cat /var/run/sshd.pid)\$" __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
On Wed, Mar 10, 2010 at 06:15:32PM +0100, Linas wrote:
Byron Clark wrote:
On Wed, Mar 10, 2010 at 09:32:15AM -0700, Byron Clark wrote:
if pidof sshd | grep -q $(cat /var/run/sshd.pid); then echo "pid in /var/run/sshd.pid is valid" else echo "invalid pid" fi Ignore that, it isn't entirely safe.
You may want grep -q "^$(cat /var/run/sshd.pid)\$"
Unfortunately that only works if there is only one sshd process returned by pidof. Here's the case I'm worried about: /var/run/sshd.pid: 343 pidof sshd: 3433 -- Byron Clark
On Wed, Mar 10, 2010 at 10:24:10AM -0700, Byron Clark wrote:
On Wed, Mar 10, 2010 at 06:15:32PM +0100, Linas wrote:
Byron Clark wrote:
On Wed, Mar 10, 2010 at 09:32:15AM -0700, Byron Clark wrote:
if pidof sshd | grep -q $(cat /var/run/sshd.pid); then echo "pid in /var/run/sshd.pid is valid" else echo "invalid pid" fi Ignore that, it isn't entirely safe.
You may want grep -q "^$(cat /var/run/sshd.pid)\$"
Unfortunately that only works if there is only one sshd process returned by pidof. Here's the case I'm worried about:
/var/run/sshd.pid: 343 pidof sshd: 3433
And the case where add ^$ around the pid breaks: /var/run/sshd.pid: 343 pidof sshd: 343 2452 2453 -- Byron Clark
Byron Clark wrote:
Unfortunately that only works if there is only one sshd process returned by pidof. Here's the case I'm worried about:
/var/run/sshd.pid: 343 pidof sshd: 3433
And the case where add ^$ around the pid breaks:
/var/run/sshd.pid: 343 pidof sshd: 343 2452 2453
Yes of course. I foolishly only thought "how to avoid matching partial numbers" despite being aware of the general problem. What we need are word boundaries: grep -q "\\b$(cat /var/run/sshd.pid)\\b" __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com
participants (2)
-
Byron Clark
-
Linas