-
Notifications
You must be signed in to change notification settings - Fork 0
/
run_wm.sh
executable file
·78 lines (59 loc) · 1.52 KB
/
run_wm.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#!/bin/bash
if [ -r /etc/default/locale ]; then
. /etc/default/locale
export LANG LANGUAGE
fi
export DISPLAY=:20
export XORG_RUN_AS_USER_OK=1
# export XRDP_START_WIDTH=1920
# export XRDP_START_HEIGHT=1080
export XRDP_START_WIDTH=2560
export XRDP_START_HEIGHT=1220
FORCE_START=0
DO_STOP=0
# Parse command line arguments
while [[ $# -gt 0 ]]; do
key="$1"
case $key in
-d|--display)
export DISPLAY="$2"
shift
shift
;;
-f|--force)
FORCE_START=1
shift
;;
-s|--stop)
DO_STOP=1
shift
;;
*)
break
;;
esac
done
xorg_proc=`ps aux | grep Xorg | grep $DISPLAY | grep -v grep | awk '{print $2}'`
if [ "$xorg_proc" != "" ]; then
if [ $DO_STOP == 1 ]; then
echo "Stopping Xorg running on display $DISPLAY"
kill -9 $xorg_proc
exit 0
elif [ $FORCE_START != 1 ]; then
echo "Xorg is already running on display $DISPLAY"
exit 1
elif [ $FORCE_START == 1 ]; then
echo "Xorg is already running on display $DISPLAY: stopping current process..."
kill -9 $xorg_proc
sleep 3
fi
fi
if [ $DO_STOP != 1 ]; then
echo "Starting Xorg on display $DISPLAY in the background (logs available at /tmp/xorg.log)..."
nohup Xorg :20 -config /etc/X11/xrdp/xorg.conf -verbose > /tmp/xorg.log 2>&1 &
sleep 3
echo "... Starting xfce4"
startxfce4
elif [ "$xorg_proc" == "" ]; then
echo "Xorg is not running on display $DISPLAY"
fi