#!/usr/bin/csh -f # # vnc - quick and dirty script to list running vnc servers # # 2006 Apr 18 jlyke Original # 2006 May 05 jlyke # 2007 Aug 21 jlyke added runtime to output # 2018 Mar 01 jlyke add OS check to run both Linux/Solaris # #----------------------------------------------------------------------- set pid = `echo $$` if ( `uname` == "Linux" ) then set psarg = "-eo" else set psarg = "-elfo" endif # print out a header echo "" echo "Owner PID Server Runtime (dd-)hh:mm:ss" echo "===================================================" /usr/bin/ps $psarg "user pid etime args" | awk '$4 ~ /Xvnc/ {printf("%-10s %6d %-7s %-12s\n",$1,$2,$5,$3)}' | sed 's/:/'$HOST':/' | sort -k 1 echo "---------------------------------------------------" echo "" echo "" echo "Before shutting down a VNC server, make sure nothing important is" echo "running in it." echo "To shutdown a VNC server, login to the host as the owner and run:" echo "vncserver -kill :##" echo "" exit