You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: bin/rsc
+49-18Lines changed: 49 additions & 18 deletions
Original file line number
Diff line number
Diff line change
@@ -63,7 +63,7 @@
63
63
### rsc config --full
64
64
### rsc log
65
65
###
66
-
### Version: 0.14.1
66
+
### Version: 0.14.2
67
67
### Copyright: Henrik Bengtsson (2022-2023) and Harry Putnam (2022)
68
68
### License: ISC
69
69
@@ -270,7 +270,9 @@ function acquire_lock_file {
270
270
271
271
lockfile=${workdir}/pid.lock
272
272
if [[ -f"${lockfile}" ]];then
273
-
error "${USER}, another RStudio Server instance of yours is already running on $(rserver_hostname) on this system. Call '${blue}rsc status --full${undo}' for details on how to reconnect. If you want to start a new instance, please terminate the existing one first by calling '${blue}rsc stop${undo}' from that machine."
273
+
msg="${USER}, another RStudio Server instance of yours is already running on $(rserver_hostname) on this system. Call '${blue}rsc status --full${undo}' for details on how to reconnect. If you want to start a new instance, please terminate the existing one first by calling '${blue}rsc stop${undo}' from that machine."
274
+
msg="${msg} As a last resort, for instance, if that machine is no longer available or down for maintenance, try ${blue}rsc reset --force${undo}."
275
+
error "${msg}"
274
276
fi
275
277
echo"${PPID}">"${lockfile}"
276
278
}
@@ -313,6 +315,8 @@ function remove_stray_pid_file {
313
315
local -i pid
314
316
local rserver_hostname
315
317
local what
318
+
local res
319
+
local -i okay
316
320
317
321
what=${1:?}
318
322
@@ -360,8 +364,13 @@ function remove_stray_pid_file {
360
364
mdebug " - hostname=$(hostname)"
361
365
362
366
## If this process is not running, remove the PID file
warn "Detected a stray PID file (${pid_file}). This file was removed, because it referred to a ${what} process (PID ${pid} on ${rserver_hostname}) which is no longer running."
mwarn "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."
490
+
fi
491
+
}
492
+
476
493
functioncheck_pid {
477
494
local -i pid
478
495
local hostname
479
496
local pid_exists
480
497
local asterisk
481
498
local timeout
499
+
local res
500
+
local -i okay
482
501
483
502
## If 'pid' is assigned an empty value, then it becomes pid=0,
484
503
## because we declared it as an integer above.
@@ -497,9 +516,16 @@ function check_pid {
497
516
[[ -d"/proc/${pid}" ]] && pid_exists=true
498
517
elif${ssh};then
499
518
mdebug "- Checking /proc/${pid} on ${hostname} over SSH ($(ssh_timeout)-second timeout)"
500
-
mwarn "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."
501
519
#shellcheck disable=SC2029
502
-
res=$(ssh -o ConnectTimeout="$(ssh_timeout)""${hostname}""[[ -d '/proc/${pid}' ]] && echo true || echo false"2>&1)|| error "Failed to check process PID ${pid} on ${hostname} over SSH. Reason was: ${res}"
msg="${msg}\nImportantly, if you are running from a remote machine without direct access to ${hostname}, you need to set up SSH port forwarding first, which you can do by running:\n\\n ${blue}ssh -L ${localport}:${hostname}:${port}${USER}@$(find_login_host)${undo}\n\nin a second terminal from your local computer.\n"
msg="${msg}\nImportantly, if you are running from a remote machine without direct access to ${hostname}, you need to set up SSH port forwarding first, which you can do by running:\n\\n ${blue}ssh -L ${localport}:${hostname}:${port}${USER}@$(find_login_host)${undo}\n\nin a second terminal from your local computer.\n"
0 commit comments