[arch-general] [arch-dev-public] [signoff] openssh 5.4p1-2

Byron Clark byron at theclarkfamily.name
Wed Mar 10 18:26:03 CET 2010


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


More information about the arch-general mailing list