running vncserver for just one command. bash script version

I wrote this bash function more than 2 years ago.

running vncserver for just one command, bash function implementation
Real unix sysadmin may want to use X-window sometimes, like when you want to analyze network packet or install Oracle. So, here it is a bash function to run just a single command.


But since I thought oracle DBAs don't invoke this function often, I created a bash script with some enhancements.
For dbca & netca & dbua, passing '-q' option will automatically shut down the vnc server.
But for OUI(runInstaller), you can't.
#!/bin/bash
if [ ! -d ~/.vnc ]; then
  mkdir ~/.vnc
else
  mv -i ~/.vnc/xstartup{,.$$}
  rm -i ~/.vnc/xstartup
fi
echo "vncconfig -iconic &" > ~/.vnc/xstartup
getopts 'q' OPT && shift
echo "$* &" >> ~/.vnc/xstartup
echo 'onecommand=$!' >> ~/.vnc/xstartup
echo "twm &" >> ~/.vnc/xstartup
[ $OPT == "q" ] && echo "wait \$onecommand; vncserver -kill \$DISPLAY" >> ~/.vnc/xstartup
chmod u+x ~/.vnc/xstartup
vncserver -geometry 1024x992 -depth 8
#wait $(pgrep -s 0 Xvnc)
echo "Restore previous ~/.vnc/xstartup file?"
mv -i ~/.vnc/xstartup{.$$,}



Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

The views expressed on this blog are my own and do not necessarily reflect the views of Oracle.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
   
       
Today