{"id":3436,"date":"2023-02-27T20:25:09","date_gmt":"2023-02-27T19:25:09","guid":{"rendered":"https:\/\/kudzia.eu\/b\/?p=3436"},"modified":"2023-02-27T20:26:04","modified_gmt":"2023-02-27T19:26:04","slug":"re-parenting-a-shell-command","status":"publish","type":"post","link":"https:\/\/kudzia.eu\/b\/2023\/02\/re-parenting-a-shell-command\/","title":{"rendered":"re-parenting a shell command"},"content":{"rendered":"\n<p>let&#8217;s say you&#8217;ve logged in via ssh to some server and started some long running command. minutes or hours later you&#8217;ve realized that you did not run it under screen or tmux &#8211; so that command will die once your ssh connection is closed. today i&#8217;ve learned about <a href=\"https:\/\/github.com\/nelhage\/reptyr\">reptyr<\/a> which can help with that &#8211; it allows to take over another command e.g. to push it take it over into screen session.<\/p>\n\n\n\n<p>in one ssh session, without screen\/tmux, i&#8217;m running:<\/p>\n\n\n\n<p><code>xz -kv a_large_file.<\/code>sql<\/p>\n\n\n\n<p><\/p>\n\n\n\n<p>to take it over &#8211; in another windows, this time within tmux\/screen session:<\/p>\n\n\n\n<p><code>ps faux|grep xz<br>reptyr 1234<\/code><\/p>\n\n\n\n<p>that&#8217;s it, now command continues to run with output coming to the terminal multiplexer. it&#8217;ll run even if my ssh session breaks.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>let&#8217;s say you&#8217;ve logged in via ssh to some server and started some long running command. minutes or hours later you&#8217;ve realized that you did not run it under screen or tmux &#8211; so that command will die once your ssh connection is closed. today i&#8217;ve learned about reptyr which can help with that &#8211; [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[17,51],"tags":[],"class_list":["post-3436","post","type-post","status-publish","format-standard","hentry","category-tech","category-unimportant"],"_links":{"self":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3436","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/comments?post=3436"}],"version-history":[{"count":2,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3436\/revisions"}],"predecessor-version":[{"id":3438,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/posts\/3436\/revisions\/3438"}],"wp:attachment":[{"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/media?parent=3436"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/categories?post=3436"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kudzia.eu\/b\/wp-json\/wp\/v2\/tags?post=3436"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}