Skip to content

Commit 94708a8

Browse files
Give timestamp information on the internal 'rserver.hostname' file in warning
1 parent 704c5b7 commit 94708a8

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

NEWS.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
### Miscellaneous
44

5+
* Now `rsc log` and `rsc stop` give timestamp information on the
6+
internally recorded RStudio hostname, whenever they produce a
7+
warning.
8+
59
* Now `rsc log` produces more informative warnings regarding on what
610
host it thinks RStudio is running and the current machine.
711

bin/rsc

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@
6363
### rsc config --full
6464
### rsc log
6565
###
66-
### Version: 0.16.1-9001
66+
### Version: 0.16.1-9003
6767
### Copyright: Henrik Bengtsson (2022-2024) and Harry Putnam (2022)
6868
### License: ISC
6969

@@ -377,7 +377,7 @@ function remove_stray_pid_file {
377377

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

383383
## Get rserver hostname
@@ -386,7 +386,7 @@ function remove_stray_pid_file {
386386
mdebug " - hostname=$(hostname)"
387387

388388
## If this process is not running, remove the PID file
389-
warn_if_check_pid_needs_ssh "${pid}" "${rserver_hostname}"
389+
warn_if_check_pid_needs_ssh "${pid}" "${rserver_hostname}" " [${file}: $(file_info "${file}")]"
390390
mapfile -t res < <(check_pid "${pid}" "${rserver_hostname}" 2>&1)
391391
okay=$?
392392
mdebug " - check_pid('${pid}', '${rserver_hostname}') exit code: ${okay}, output='$(printf "%q" "${res[*]}")'"
@@ -520,10 +520,12 @@ function parse_revtunnel {
520520
function warn_if_check_pid_needs_ssh {
521521
local -i pid
522522
local hostname
523+
local info
523524
pid=${1:-?}
524525
hostname=${2:-?}
526+
info=${3}
525527
if ${ssh} && [[ "${hostname}" != "$(hostname)" ]]; then
526-
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. The current machine is $(hostname)"
528+
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)"
527529
fi
528530
}
529531

@@ -1798,7 +1800,8 @@ elif [[ "${action}" == "stop" ]]; then
17981800
lockfile=${workdir}/pid.lock
17991801
## If running, make sure we're stopping from the correct machine
18001802
if [[ -f "${lockfile}" ]] && [[ "$(hostname)" != "$(rserver_hostname)" ]]; then
1801-
error "Stopping the RStudio Server can only be made from the machine ($(rserver_hostname)) where it was started from - not from $(hostname)"
1803+
file="${workdir}/rserver.hostname"
1804+
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}")]"
18021805
fi
18031806

18041807
## Terminate rsession

0 commit comments

Comments
 (0)