Edit post
subject
Title
edit
# 背景 是咁的,有時ssh去server run d batch job會唔記得入screen先,冇用screen又如果熄左terminal既話個batch job會terminate左,見batch job行到一半又唔想term左佢重新係screen入行過面。 reptyr可以將個process塞返入其他tty,例如`screen`或者`tmux`度。 # 安裝 裝screen同埋reptyr。 `# pacman -S screen reptyr` # 搵PID 搵返server batch job個pid出黎,例如backup個process係叫`duplicity`。 `$ ps -ax | grep duplicity` 其實用`htop`都得架啦。 # 移個PID去其他tty `$ reptyr ${PID}`,例如`$ reptyr 1851` ## 伏 不過通常會爆類似呢個error出黎 Timed out waiting for child stop. Unable to attach to pid 10625: Operation not permitted The kernel denied permission while attaching. If your uid matches the target's, check the value of /proc/sys/kernel/yama/ptrace_scope. For more information, see /etc/sysctl.d/10-ptrace.conf 意思係你個kernel冇咁permissive,有d 安全設定唔比你轉process tty,雖然明明uid一樣... ## 呢個時候,就要 > /etc/sysctl.d/10-ptrace.conf kernel.yama.ptrace_scope = 0 再run `# sysctl -p /etc/sysctl.d/10-ptrace.conf` ## 再黎 `$ reptyr 1851` 搞掂。 Protip: 唔好對住shell process (e.g. bash/zsh)用reptyr。
Content
vpn_key
Password
Preview
Powered by
Simple Blog