With a little help from ChatGPT I wrote these two scripts that stop the server if running, copy the right xstartup version and launch the server:
VNCPianoteq.shVNCOrganteq.shMay be not the most sophisticated but it works! ![Smile :)]()
VNCPianoteq.sh
Code:
#!/bin/bash# Check if VNC is runningcheck_vnc() {if pgrep -f "vncserver-virtual" > /dev/nullthenecho "VNC server is running."return 0elseecho "VNC server is not runnning."return 1fi}# Stop VNC serverstop_vnc() {echo "Stopping VNC server."vncserver-virtual -kill :1sleep 2 # Wait to ensure it stops}# Start VNC serverstart_vnc() {echo "Starting VNC server."cp ~/.vnc/xstartupP ~/.vnc/xstartupvncserver-virtual}# Mainif check_vnc; thenstop_vncfistart_vncCode:
#!/bin/bash# Check if VNC is runningcheck_vnc() {if pgrep -f "vncserver-virtual" > /dev/nullthenecho "VNC server is running."return 0elseecho "VNC server is not runnning."return 1fi}# Stop VNC serverstop_vnc() {echo "Stopping VNC server."vncserver-virtual -kill :1sleep 2 # Wait to ensure it stops}# Start VNC serverstart_vnc() {echo "Starting VNC server."cp ~/.vnc/xstartupO ~/.vnc/xstartupvncserver-virtual}# Mainif check_vnc; thenstop_vncfistart_vncStatistics: Posted by jimmi61 — Mon Feb 10, 2025 6:25 am