-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathrstudio-launcher
More file actions
executable file
·32 lines (29 loc) · 917 Bytes
/
rstudio-launcher
File metadata and controls
executable file
·32 lines (29 loc) · 917 Bytes
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
#!/bin/bash
# launch rstudio from the commandline
# Ruoshi Sun
# 2023-08-30
module purge
module load goolf rstudio-server
read LOWERPORT UPPERPORT < /proc/sys/net/ipv4/ip_local_port_range
while :; do
PORT="`shuf -i $LOWERPORT-$UPPERPORT -n 1`"
ss -lpn | grep -q ":$PORT " || break
done
echo "Instructions:
1. run this script on OOD Desktop or FastX
2. open Firefox
3. in the address bar enter:
localhost:$PORT
"
MYTMP=`mktemp -d`
export RSTUDIO_CONFIG_DIR="$MYTMP"
export XDG_DATA_HOME="$MYTMP/.data"
export XDG_CACHE_HOME="$MYTMP/.cache"
mkdir "$XDG_DATA_HOME" "$XDG_CACHE_HOME"
export RS_LOG_DIR="$MYTMP/log"
echo -e "provider=sqlite\\ndirectory=$MYTMP/db" >> "$MYTMP/db.conf"
rserver --server-user="$USER"\
--database-config-file="$MYTMP/db.conf"\
--server-data-dir="$MYTMP/sdd"\
--secure-cookie-key-file="$MYTMP/secure-cookie-key"\
--server-daemonize=0 --www-port=$PORT