Skip to content

Commit

Permalink
Merge branch 'release/0.16.2'
Browse files Browse the repository at this point in the history
  • Loading branch information
HenrikBengtsson committed Aug 21, 2024
2 parents c629e58 + 09099db commit ca03fa4
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 12 deletions.
12 changes: 12 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,15 @@
## Version 0.16.2 [2024-08-21]

### Miscellaneous

* Now `rsc log` and `rsc stop` give timestamp information on the
internally recorded RStudio hostname, whenever they produce a
warning.

* Now `rsc log` produces more informative warnings regarding on what
host it thinks RStudio is running and the current machine.


## Version 0.16.1 [2024-08-20]

### Miscellaneous
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -333,20 +333,20 @@ As before, the RStudio Server is available at
```sh
$ cd /path/to/software
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.16.1.tar.gz
$ tar xf 0.16.1.tar.gz
$ PATH=/path/to/softwarerstudio-server-controller-0.16.1/bin:$PATH
$ curl -L -O https://github.com/UCSF-CBI/rstudio-server-controller/archive/refs/tags/0.16.2.tar.gz
$ tar xf 0.16.2.tar.gz
$ PATH=/path/to/softwarerstudio-server-controller-0.16.2/bin:$PATH
$ export PATH
$ rsc --version
0.16.1
0.16.2
```
To verify that the tool can find R and the RStudio Server executables,
call:
```sh
$ rsc --version --full
rsc: 0.16.1
rsc: 0.16.2
RStudio Server: 2023.06.2+561 (Mountain Hydrangea) for Linux [/path/to/rstudio-server/bin/rstudio-server]
R: 4.3.1 (2023-06-16) -- "Shortstop Beagle" [/path/to/R/bin/R]
```
Expand Down
23 changes: 16 additions & 7 deletions bin/rsc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
### rsc config --full
### rsc log
###
### Version: 0.16.1
### Version: 0.16.2
### Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
### License: ISC

Expand Down Expand Up @@ -377,7 +377,7 @@ function remove_stray_pid_file {

## Nothing to do?
file="${workdir}/rserver.hostname"
mdebug " - rserver hostname file=${file}"
mdebug " - rserver hostname file=${file} [$(file_info "${file}")]"
[[ ! -f "${file}" ]] && return 0;

## Get rserver hostname
Expand All @@ -386,7 +386,7 @@ function remove_stray_pid_file {
mdebug " - hostname=$(hostname)"

## If this process is not running, remove the PID file
warn_if_check_pid_needs_ssh "${rserver_hostname}"
warn_if_check_pid_needs_ssh "${pid}" "${rserver_hostname}" " [${file}: $(file_info "${file}")]"
mapfile -t res < <(check_pid "${pid}" "${rserver_hostname}" 2>&1)
okay=$?
mdebug " - check_pid('${pid}', '${rserver_hostname}') exit code: ${okay}, output='$(printf "%q" "${res[*]}")'"
Expand Down Expand Up @@ -518,10 +518,14 @@ function parse_revtunnel {
}

function warn_if_check_pid_needs_ssh {
local -i pid
local hostname
hostname=${1:-?}
local info
pid=${1:-?}
hostname=${2:-?}
info=${3}
if ${ssh} && [[ "${hostname}" != "$(hostname)" ]]; then
warn "Needs to SSH to ${hostname} to check whether process ${pid} is still alive. If you don't have SSH key authentication set up, you will be asked to enter your account password below."
warn "Needs to SSH to ${hostname} to check whether process ${pid} is still alive${info}. If you don't have SSH key authentication set up, you will be asked to enter your account password below. The current machine is $(hostname)"
fi
}

Expand Down Expand Up @@ -683,7 +687,7 @@ function rs_process_status {

## Check if PID is still active?
if [[ ${pid} -ne 0 ]]; then
warn_if_check_pid_needs_ssh "${hostname}"
warn_if_check_pid_needs_ssh "${pid}" "${hostname}"
mapfile -t res < <(check_pid "${pid}" "${rserver_hostname}" 2>&1)
okay=$?
mdebug " - check_pid('${pid}', '${rserver_hostname}') exit code: ${okay}, output='$(printf "%q" "${res[*]}")'"
Expand Down Expand Up @@ -1613,6 +1617,10 @@ mdebug "RSC_RSESSION_TIMEOUT: ${RSC_RSESSION_TIMEOUT:-<not set>}"
mdebug "RSC_SSH: ${RSC_SSH:-<not set>}"
mdebug "RSC_SSH_LOGIN_HOSTNAME: ${RSC_SSH_LOGIN_HOSTNAME:-<not set>}"
mdebug "RSC_SSH_TIMEOUT: ${RSC_SSH_TIMEOUT:-<not set>}"
mdebug "_RSC_RSERVER_HOSTNAME_: ${_RSC_RSERVER_HOSTNAME_:-<not set>}"
mdebug "_RSC_RSERVER_PORT_: ${_RSC_RSERVER_PORT_:-<not set>}"
mdebug "_RSC_RSERVER_PID_: ${_RSC_RSERVER_PID_:-<not set>}"
mdebug "_RSC_RSERVER_DATA_DIR_: ${_RSC_RSERVER_DATA_DIR_:-<not set>}"
mdebug "args: [n=${#args[@]}] ${args[*]}"

## Enable terminal colors, if supported
Expand Down Expand Up @@ -1792,7 +1800,8 @@ elif [[ "${action}" == "stop" ]]; then
lockfile=${workdir}/pid.lock
## If running, make sure we're stopping from the correct machine
if [[ -f "${lockfile}" ]] && [[ "$(hostname)" != "$(rserver_hostname)" ]]; then
error "Stopping the RStudio Server can only be made from the machine ($(rserver_hostname)) where it was started from - not from $(hostname)"
file="${workdir}/rserver.hostname"
error "Stopping the RStudio Server can only be made from the machine ($(rserver_hostname)) where it was started from - not from $(hostname) [${file}: $(file_info "${file}")]"
fi

## Terminate rsession
Expand Down

0 comments on commit ca03fa4

Please sign in to comment.