Skip to content

Commit

Permalink
VNC 环境自动设置工具 第一版
Browse files Browse the repository at this point in the history
  • Loading branch information
JiangLiNSCC committed May 26, 2016
1 parent 998200a commit 56fc17d
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 0 deletions.
1 change: 1 addition & 0 deletions vis/killallnonvc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
ps x | grep noVNC | awk '{ print $1 }' | xargs -n 1 kill -9
10 changes: 10 additions & 0 deletions vis/runvnc.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/bin/sh
source ./settings.sh
echo $VNC_PW1 $VNC_PW2 $VNC_PAR
rm -r log.httpadd > /dev/null
yhbatch -p docker server.sh
until [ -e ./log.httpadd ]
do
sleep 5
done
cat log.httpadd
15 changes: 15 additions & 0 deletions vis/server.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
#!/bin/sh
#SBATCH -N 1
rm -rf ~/.vnc/* ./hostport ./log.novnc &>/dev/null
#./startvncs.tcl
# del all vncserver
/WORK/app/TurboVNC/bin/vncserver -list | grep '^:' | cut -c 2 | xargs -n 1 -t -i /WORK/app/TurboVNC/bin/vncserver -kill :{}
ps x | grep /WORK/app/TurboVNC/bin/Xvnc | awk '{print p}{p=$1}' | xargs -n 1 -t kill -9
/WORK/app/TurboVNC/bin/vncpasswd2 $VNC_PW1 $VNC_PW2
/WORK/app/TurboVNC/bin/vncserver
VNCPORT=`ps x | grep 'rfbport'| grep -v grep | head -n 1 | awk 'BEGIN{RS="-"} {print $0}' | grep rfbport | awk '{print $2}'`
echo `hostname`:$VNCPORT > ./hostport
ssh $VNC_SNNM /WORK/app/noVNC/utils/noVNC --vnc `cat hostport` > ./log.novnc &
sleep 10
cat log.novnc | grep http | sed "s/$VNC_SNNMS/$VNC_SNIP/g" > log.httpadd
wait
7 changes: 7 additions & 0 deletions vis/settings.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#!/bin/sh
export VNC_PW1=123456
export VNC_PW2=654321
export VNC_PAR=docker
export VNC_SNIP=172.16.23.16
export VNC_SNNM=ln6-gn0
export VNC_SNNMS=ln6

0 comments on commit 56fc17d

Please sign in to comment.