-
Notifications
You must be signed in to change notification settings - Fork 0
/
vnc.sh
42 lines (33 loc) · 853 Bytes
/
vnc.sh
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
31
32
33
34
35
36
37
38
39
40
41
42
#!/bin/bash
# Startup file that fix and help startup.
start() {
# Start the VNC server with all the needed programs and files
vncserver $1 # Start the VNC server
export DISPLAY=$1
autocutsel -fork # Clipboard helper
}
stop() {
vncserver -kill $1
}
# Set the display number to a default value
if [[ -z $2 ]]; then
display=":1"
else
display="$2"
fi
# Commands to be started
if [[ "$1" == "start" ]]; then
echo "Starting VNC server at display $display"
start $display
elif [[ "$1" == "stop" ]]; then
echo "Stopping VNC server at display $display"
stop $display
elif [[ "$1" == "help" ]]; then
echo “Usage $0 COMMAND DISPLAY_VALUEâ€
echo “COMMAND: start / stopâ€
echo “DISPLAY_VALUE : Is the number of the Xorg sessionâ€
echo “Format of DISPLAY_VALUE - :1 :2 :3â€
else
echo "Invalid argument"
fi
exit 0