Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8082

Raspberry Pi OS • Re: VNC server to launch two app without Desktop env

$
0
0
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.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_vnc
VNCOrganteq.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/xstartupO ~/.vnc/xstartupvncserver-virtual}# Mainif check_vnc; thenstop_vncfistart_vnc
May be not the most sophisticated but it works! :)

Statistics: Posted by jimmi61 — Mon Feb 10, 2025 6:25 am



Viewing all articles
Browse latest Browse all 8082

Trending Articles