Skip to contentSkip to conversation

/bin/checkvnc

PATCH In review Graydon, Tracy 2 participants 2 messages Aug 15, 2017 – Aug 16, 2017

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 /bin/checkvnc

[Yocto #11897]

The checkvnc script uses deprecated netstat command for finding vnc sessions. This breaks on Centos, and will break on other OS as it is removed in the future.

Drop the dependency on netstat and instead grep /proc/net/tcp for active sessions on 5901 port.

---
 bin/checkvnc | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
bin/checkvnc +1 -1
index d934dfa..11e03bb 100755
@@ -2,7 +2,7 @@
 #
 # check if vnc server is running, and if not, cleanup and restart
 #
-netstat -tnl | grep :5901 > /dev/null
+grep ':170D' /proc/net/tcp > /dev/null
 if [ $? != 0 ]; then
     echo "Xvnc not running, attempting restart"
     vncserver -kill :1
Signature · 1 line
2.7.0
#1 lore raw

Thanks, queued for merge (after tweaking the commit message some)

Joshua

Quoted 28 lines · Tracy

[Yocto #11897]

The checkvnc script uses deprecated netstat command for finding vnc sessions. This breaks on Centos, and will break on other OS as it is removed in the future.

Drop the dependency on netstat and instead grep /proc/net/tcp for active sessions on 5901 port.

---
  bin/checkvnc | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
bin/checkvnc +1 -1
index d934dfa..11e03bb 100755
@@ -2,7 +2,7 @@
  #
  # check if vnc server is running, and if not, cleanup and restart
  #
-netstat -tnl | grep :5901 > /dev/null
+grep ':170D' /proc/net/tcp > /dev/null
  if [ $? != 0 ]; then
      echo "Xvnc not running, attempting restart"
      vncserver -kill :1