#539 active SSH connection does not stop phone from sleeping if SSHing via IPv6 1 year, 7 months ago

Ticket created by ~bwildenhain on ~mil/sxmo-tickets

I investigated how to prevent my phone from going to sleep while using SSH. Currently default_hooks/sxmo_hook_check_state_mutexes.sh checks using the following command for a running SSH session:

netstat -tn | grep ESTABLISHED | cut -d':' -f2 | grep -q '^22 '

As IPv6 addresses contain colons itself, this only works for IPv4. I would suggest to change this to the following:

netstat -tn | grep ESTABLISHED | cut -d\ -f16 | grep -q ':22$'

(or, for easier readibility, but with new dependency on preinstalled awk):

netstat -tn | grep ESTABLISHED | awk '{ print $4 }' | grep -q ':22$'