[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: is sshd really restarting?





Le 18.12.2014 18:13, Harry Putnam a écrit :
Setup: very new install of gentoo

When I restart ssh like so:

   sudo /etc/init.d/ssh restart

I see very little output. Should it be more verbose?

,----
|    harry > sudo /etc/init.d/ssh restart
|   Restarting ssh (via systemctl): ssh.service
`----

Can I get more verbose output?

I have no idea. Anyway, if you really want to know if ssh really restarted, I guess the easier is this:

PID1=$(echo $(ps -A |grep sshd)|cut -f1 -d' ')
service ssh restart
[ $PID1 == $(echo $(ps -A |grep sshd)|cut -f1 -d' ') ] && echo ko || echo ok

I wonder if there is a way to make it a one liner. (it just save the old PID of sshd, restart sshd, and check if PID changed. If yes, then it prints ok, otherwise ko.)


Reply to: