diff --git a/NEWS.md b/NEWS.md index 842f03d..e8ab7f0 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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 diff --git a/README.md b/README.md index 2de863e..b6debf6 100644 --- a/README.md +++ b/README.md @@ -333,12 +333,12 @@ 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, @@ -346,7 +346,7 @@ 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] ``` diff --git a/bin/rsc b/bin/rsc index 0f045b4..4873c15 100755 --- a/bin/rsc +++ b/bin/rsc @@ -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 @@ -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 @@ -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[*]}")'" @@ -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 } @@ -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[*]}")'" @@ -1613,6 +1617,10 @@ mdebug "RSC_RSESSION_TIMEOUT: ${RSC_RSESSION_TIMEOUT:-}" mdebug "RSC_SSH: ${RSC_SSH:-}" mdebug "RSC_SSH_LOGIN_HOSTNAME: ${RSC_SSH_LOGIN_HOSTNAME:-}" mdebug "RSC_SSH_TIMEOUT: ${RSC_SSH_TIMEOUT:-}" +mdebug "_RSC_RSERVER_HOSTNAME_: ${_RSC_RSERVER_HOSTNAME_:-}" +mdebug "_RSC_RSERVER_PORT_: ${_RSC_RSERVER_PORT_:-}" +mdebug "_RSC_RSERVER_PID_: ${_RSC_RSERVER_PID_:-}" +mdebug "_RSC_RSERVER_DATA_DIR_: ${_RSC_RSERVER_DATA_DIR_:-}" mdebug "args: [n=${#args[@]}] ${args[*]}" ## Enable terminal colors, if supported @@ -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