웹에서 top명령어를 실행하도록 만들면 TERM environment variable not set 이런 에러메세지가 뜹니다.

visualplus의 이미지

웹은 apache-ssl 구동중이고, python으로 만들고있습니다.

웹에서 특정 버튼을 누르면 os.popen 으로 명령어 실행 후 결과값을 얻어오게 했는데,
TERM environment variable not set
이런 오류메세지만 나옵니다.

그래서 봤더니 TERM이라는 환경변수가 필요한것 같은데..
이것을 어디서 셋팅해줘야 하는지 모르겠습니다.

.bashrc 파일처럼 apache에 기본 환경변수 설정할만한곳이 어디에 있는지 알고싶습니다.

Hyun의 이미지

top는 터미널 안에서 실행하는 프로그램일텐데, 차라리 ps 등을 주기적으로 refresh 해서 실행하는게 좋지 않나요?


나도 세벌식을 씁니다
bushi의 이미지

man top

[bushi@rose net]$ TERM= top -n1 | head -15
TERM environment variable not set.
[bushi@rose net]$ 
[bushi@rose net]$ TERM= top -b -n1 | head -15
top - 22:40:26 up 22 days,  3:52,  8 users,  load average: 0.00, 0.08, 0.08
Tasks: 189 total,   1 running, 187 sleeping,   0 stopped,   1 zombie
Cpu(s):  2.0%us,  0.8%sy,  0.0%ni, 96.8%id,  0.3%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   2072216k total,  1985460k used,    86756k free,    93368k buffers
Swap:  2096472k total,   832080k used,  1264392k free,   512408k cached
 
  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND            
 3603 bushi     20   0 58672  29m  24m S    4  1.5 609:40.50 compiz             
 4995 bushi     20   0  179m  27m  13m S    4  1.4  70:50.22 gnome-terminal     
 2494 root      20   0  2640  316  256 S    2  0.0  43:50.43 irqbalance         
 3237 root      20   0  442m 183m  12m S    2  9.1   1162:40 X                  
 4168 bushi     20   0 1431m 302m  37m S    2 15.0   1576:46 firefox-bin        
19343 bushi     20   0  2400  940  684 R    2  0.0   0:00.20 top                
23283 bushi     20   0 14116 3788 3184 S    2  0.2  38:27.35 at-spi-registry    
    1 root      20   0  2112  604  568 S    0  0.0   0:12.20 init               
[bushi@rose net]$ 

OTL

댓글 달기

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
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.