screen 에서 수행한 프로그램 종료후 kill 하지 않기.

only2sea의 이미지

screen 을 쓰다가 궁금한 점이 있어서 여쭙습니다.

screen xxx 와 같이 명령을 수행하면 스크린이 새로 생기고 xxx가 실행되는데 꽤 유용하게 쓰고 있습니다. 그런데 프로그램이 종료하자마자 screen이 kill 되므로 결과를 볼 수가 없는데, man 페이지에서는 이것이 default라고 되어 있습니다. 그런데, 이렇게 하지 않는 방법은 없을까요? 혹은 죽은 스크린에 있었던 output을 볼 수 있는 방법이 있나요?

Quote:
... When a program terminates, screen (per default) kills the
window that contained it. If this window was in the foreground, the
display switches to the previous window; if none are left, screen
exits.

송효진의 이미지

screen [enter]
프로그램실행 [enter]
ctrl+a+d

screen -r

emerge money
http://wiki.kldp.org/wiki.php/GentooInstallSimple - 명령어도 몇개 안되요~
http://xenosi.de/

only2sea의 이미지

송효진님 답변 감사드립니다. 그런데 제가 궁금한 것은 screen xxx 와 같이 실행한 뒤에 스크린이 안 죽게 하는 것이었습니다. 저렇게 하면 새로 쉘이 뜨게 되는데, 새로 쉘 뜨는 것이 느린 환경에서는 작업 효율이 매우 떨어지거든요.

블로그: http://turtleforward.blogspot.com

송효진의 이미지

screen "sh --noprofile --norc"
이런식으로 해서 좀 빨리 뜨게 하는것 외엔 방법 없을것 같네요.

emerge money
http://wiki.kldp.org/wiki.php/GentooInstallSimple - 명령어도 몇개 안되요~
http://xenosi.de/

M.W.Park의 이미지

only2sea님의 용도에는 screen 보다 nohup이 더 적합할 거같네요.
로그 파일로 다 남으니깐...

-----
오늘 의 취미는 끝없는, 끝없는 인내다. 1973 法頂

-----
오늘 의 취미는 끝없는, 끝없는 인내다. 1973 法頂

only2sea의 이미지

nohup도 좋지만, 그냥 screen에서 쓰고 싶어서 그래봤습니다. 컬러 출력도 되고 하려면요. 언제 끝나는지도 알기 어려운 것 같구요. 스크린 매뉴얼에는 default로 그렇다는 말이 있어서 설정 가능한 것처럼 보이는데, 없나보네요. 결국에 제가 해결한 방법은 그리 유쾌하지는 않지만...

{ eval "$*"; echo -e "\x7"; read; } 을 실행하는 쉘 스크립트를 만든 뒤에 alias에 screen과 함께 묶어버리는 방법으로 해결해 버렸습니다.

블로그: http://turtleforward.blogspot.com

only2sea의 이미지

nohup과 컬러는 상관이 없겠군요. ANSI color escape sequence들도 모두 nohup.out에 기록되니까요. 대신에 커서 중간 과정 보기가 좀 귀찮군요.

블로그: http://turtleforward.blogspot.com

ganadist의 이미지

screen_shell()
{
  screen $SHELL -l -c "$1;$SHELL"
}

은 어떤가요?

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

----
데스크탑 프로그래머를 꿈꾸는 임베디드 삽질러

only2sea의 이미지

결국 괴물같은 좀 허접한 스크립트가 나왔습니다.

cat > bin/bgr_helper
#!/usr/bin/env bash
#
# Background runner helper.
#
# Author: Jaehyun Yeom
OLD_WINDOW=$1
shift
echo -e "\e]83;select $OLD_WINDOW\a" # Going back to the original window
eval "$*" \
  && echo -e "JOB SUCCEEDED.\e!Job succeeded at ’$WINDOW’\e\\" \
  || echo -e "JOB FAILED.\e!Job failed at ’$WINDOW’\e\\"
read
^D
echo "alias bgr='screen bgr_helper \$WINDOW'" >> ~/.bash_aliases

블로그: http://turtleforward.blogspot.com

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.