Skip to content

Commit 33390ff

Browse files
committed
Add vncserver daemon script
1 parent 998187d commit 33390ff

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

android-sdk/vnc/vncserver_daemon.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# Start VNC server
4+
vncserver :1 -geometry 1280x800 -depth 24 -fp /usr/share/fonts/X11/misc/
5+
6+
# Get the PID of the VNC server
7+
vnc_pid=$(pgrep -f "Xtightvnc :1")
8+
9+
if [ -z "$vnc_pid" ]; then
10+
echo "Failed to start VNC server."
11+
exit 1
12+
fi
13+
14+
# Monitor the VNC server process
15+
echo "VNC server started with PID $vnc_pid. Monitoring..."
16+
while kill -0 $vnc_pid 2> /dev/null; do
17+
sleep 10
18+
done
19+
20+
# If we reach here, the VNC server has stopped
21+
echo "VNC server process has stopped."
22+
exit 1

0 commit comments

Comments
 (0)