10
10
# ## stop Stop the RStudio Server and any R and SSH sessions
11
11
# ## status Check whether the RStudio Server is running or not
12
12
# ## config Output configuration details
13
- # ## reset Wipe all configuration
13
+ # ## reset Wipe configuration or storage
14
14
# ## log Output rsession log
15
15
# ##
16
16
# ## Options:
29
29
# ## should be exposed. (Default: local host and --port)
30
30
# ## --random-password Generate a random password assigned to 'RSC_PASSWORD'
31
31
# ## --force Force an action
32
- # ## --full Output more information
32
+ # ## --full More of the same, e.g. output or file removal
33
33
# ## --no-ssh Skip anything involving SSH
34
34
# ##
35
35
# ## --env-pattern=<re> Regular expression matching environment variables to be
43
43
# ## argument is only for the instructions on how to set up
44
44
# ## SSH port forwarding, in case RStudio Server runs on a
45
45
# ## remote machine
46
+ # ## --user-state-data Causes 'reset' to backup user's RStudio State Storage
47
+ # ## folder to a tar file and the remove the folder
46
48
# ## ---
47
49
# ##
48
50
# ## Example:
63
65
# ## rsc config --full
64
66
# ## rsc log
65
67
# ##
66
- # ## Version: 0.16.2-9002
68
+ # ## rsc reset
69
+ # ## rsc reset --user-state-data
70
+ # ## rsc reset --force
71
+ # ##
72
+ # ## Version: 0.16.2-9003
67
73
# ## Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
68
74
# ## License: ISC
69
75
@@ -1535,6 +1541,11 @@ while [[ $# -gt 0 ]]; do
1535
1541
full=true
1536
1542
elif [[ " $1 " == " --no-ssh" ]]; then
1537
1543
ssh=false
1544
+ elif [[ " $1 " == " --user-state-dir" ]]; then
1545
+ if [[ ${action} != " reset" ]]; then
1546
+ error " Option '$1 ' only works with the 'reset' command"
1547
+ fi
1548
+ action=" reset-user-state-dir"
1538
1549
elif [[ " $1 " == " --random-password" ]]; then
1539
1550
RSC_PASSWORD=" random"
1540
1551
# # Options (--key=value):
@@ -1843,6 +1854,7 @@ elif [[ "${action}" == "stop" ]]; then
1843
1854
1844
1855
message " RStudio Server stopped"
1845
1856
elif [[ " ${action} " == " reset" ]]; then
1857
+ # # Reset the RStudio Server Controller Configuration?
1846
1858
workdir=$( config_dir)
1847
1859
if [[ -d " ${workdir} " ]]; then
1848
1860
files=(" $( rsession_pid_file) " " ${workdir} /rserver.pid" " ${workdir} /rserver_monitor.pid" " ${workdir} /rserver.hostname" " ${workdir} /rserver.port" " ${workdir} /pid.lock" )
@@ -1860,6 +1872,19 @@ elif [[ "${action}" == "reset" ]]; then
1860
1872
fi
1861
1873
rm -rf " ${workdir} "
1862
1874
fi
1875
+ elif [[ " ${action} " == " reset-user-state-dir" ]]; then
1876
+ # # Reset the RStudio User State Storage?
1877
+ workdir=$( rstudio_data_home)
1878
+ if [[ -d " ${workdir} " ]]; then
1879
+ now=$( date +" %Y%m%dT%H%M%S" )
1880
+ dest=" rstudio-config_${now} .tar"
1881
+ tar -c -f " ${dest} " " ${workdir} "
1882
+ if [[ -f " ${dest} " ]]; then
1883
+ message " Backed up your personal RStudio User State Storage: ${PWD} /${dest} [$( file_info " ${dest} " ) ]"
1884
+ rm -r -f " ${workdir} "
1885
+ message " Removed your personal RStudio User State Storage: ${workdir} "
1886
+ fi
1887
+ fi
1863
1888
elif [[ " ${action} " == " wait" ]]; then
1864
1889
wait_for_rserver
1865
1890
rserver_hostname
0 commit comments