컴퓨터 이야기
[ Tip ] watch를 사용하여 주기적으로 명령어 실행하기.
CatchMeIfYouCan
2007. 9. 3. 16:43
Usage: watch [-dhnv] [--differences[=cumulative]] [--help] [--interval=<n>] [--version] <command>
-d, --differences[=cumulative] highlight changes between updates
(cumulative means highlighting is cumulative)
-h, --help print a summary of the options
-n, --interval=<seconds> seconds to wait between updates
-v, --version print the version number
오늘 소개(?) 드릴 커맨드는 watch입니다~...
이미 많이들 사용하고 계신가요?..전 며칠전에 처음봐서-_-;;하핫.ㅋㅋㅋ
watch 라는 명령어는 주기적으로 <command>에 해당하는 명령을 실행시킬 수 있습니다.
그리고 이전 값과 차이가 발생시 그 부분을 highlight 시켜줄 수도 있구요..(제가 원하는 만큼깔끔하게 동작하지는 않지만..우선 시선을 끌수 있으므로 합격-_-;;ㅋㅋ)
만약에 서버 관리자가 간단하게 시스템의 메모리 상황이 어떻게 변하는지 알고 싶다면..
라고 입력을 하게 되면~...
다음과 같이 위에 시간값도 나오면서 1초마다 한번씩 갱신하게 됩니다.
잘만 쓰면 유용할 듯 합니다..ㅋㅋ
-d, --differences[=cumulative] highlight changes between updates
(cumulative means highlighting is cumulative)
-h, --help print a summary of the options
-n, --interval=<seconds> seconds to wait between updates
-v, --version print the version number
오늘 소개(?) 드릴 커맨드는 watch입니다~...
이미 많이들 사용하고 계신가요?..전 며칠전에 처음봐서-_-;;하핫.ㅋㅋㅋ
watch 라는 명령어는 주기적으로 <command>에 해당하는 명령을 실행시킬 수 있습니다.
그리고 이전 값과 차이가 발생시 그 부분을 highlight 시켜줄 수도 있구요..(제가 원하는 만큼깔끔하게 동작하지는 않지만..우선 시선을 끌수 있으므로 합격-_-;;ㅋㅋ)
만약에 서버 관리자가 간단하게 시스템의 메모리 상황이 어떻게 변하는지 알고 싶다면..
# watch --interval=1 "cat /proc/meminfo"
라고 입력을 하게 되면~...
다음과 같이 위에 시간값도 나오면서 1초마다 한번씩 갱신하게 됩니다.
잘만 쓰면 유용할 듯 합니다..ㅋㅋ