tuptime-Linux 시스템의 과거 및 통계 실행 시간을 표시합니다.


시스템 관리에는 Linux 시스템이 실행 된 기간을 모니터링하고 확인하는 많은 활동이 포함됩니다. 시스템 리소스 사용을 최적화하기 위해 항상 시스템 가동 시간을 추적하는 것이 좋습니다.

이 가이드에서는 시스템 관리자가 Linux 시스템이 얼마나 오래 가동되고 실행되었는지 알 수 있도록 도와주는 tuptime이라는 Linux 도구를 살펴 보겠습니다.

tuptime은 Linux 시스템의 기록 및 통계적 실행 시간 (가동 시간)을보고하는 데 사용되는 도구로, 재시작 사이에 유지됩니다. 이 도구는 uptime 명령보다 덜 작동하지만 더 고급 출력을 제공합니다.

이 명령 줄 도구는 다음을 수행 할 수 있습니다.

  1. Register used kernels.
  2. Register the first boot time.
  3. Count system startups.
  4. Count good and bad shutdowns.
  5. Calculate uptime and downtime percentage since first boot time.
  6. Calculate the largest, shortest and average uptime and downtime.
  7. Calculate the accumulated system uptime, downtime and total.
  8. Print current uptime.
  9. Print formatted table or list with most of the previous values stored.
  1. Linux or FreeBSD OS.
  2. Python 2.7 or 3.x installed but latest version is recommended.
  3. Python modules (sys, os, optparse, sqlite3, datetime, locale, platform, subprocess, time).

Linux에서 tuptime을 설치하는 방법

먼저 아래 명령을 실행하여 저장소를 복제해야합니다.

$ git clone https://github.com/rfrail3/tuptime.git

그런 다음 tuptime 디렉토리 내의 최신 디렉토리로 이동하십시오. 다음으로 최신 디렉토리의 tuptime 스크립트를/usr/bin에 복사하고 표시된대로 실행 권한을 설정합니다.

$ cd tuptime/latest 
$ sudo cp tuptime /usr/bin/tuptime
$ sudo chmod ugo+x /usr/bin/tuptime

이제 cron 파일 tuptime/latest/cron.d/tuptime을 /etc/cron.d/tuptime에 복사하고 다음과 같이 실행 권한을 설정합니다.

$ sudo cp tuptime/latest/cron.d/tuptime /etc/cron.d/tuptime
$ sudo chmod 644 /etc/cron.d/tuptime

위의 단계를 올바르게 수행했다면이 시점에서 시스템에 설치해야합니다.

tuptime은 어떻게 사용합니까?

다음으로 우리는 그림과 같이 권한이있는 사용자로 다른 옵션으로 실행하여 특정 시스템 관리 활동에이 도구를 사용하는 방법을 살펴 보겠습니다.

1. 옵션없이 tuptime을 실행하면 아래와 같은 화면이 나타납니다.

# tuptime

2. 다음과 같이 날짜와 시간으로 출력을 표시 할 수 있습니다.

# tuptime --date='%H:%M:%S %d-%m-%Y'

3. 시스템 수명을 목록으로 인쇄하려면 아래 명령을 실행할 수 있습니다.

# tuptime --list

4. 다음과 같이 대체 데이터베이스 파일을 만들 수 있습니다. "데이터베이스는 SQLite 형식으로 생성됩니다.

# tuptime --filedb /tmp/tuptime_testdb.db

5. poweroff 종료 상태별로 출력 정보를 주문하려면이 명령을 실행합니다.

# tuptime --end --table

다음과 같이 tuptime 도구와 함께 사용되는 다른 옵션 :

  1. To print the system kernel version in the output, use the --kernel option.
  2. To register a gracefully system shutdown, use the --gracefully option. It allows you to know whether the system shutdown was good or bad.
  3. To display output after a given number of seconds and epoch, use the --seconds option.
  4. You can also order output information by offtime or downtime by using the –offtime option. Use this option with --time or --list.
  5. To print detailed output information while running the command, use --verbose option.
  6. You can view help information by using --help option and --version to print the version of tuptime you are using.

요약

이 기사에서는 시스템 관리 활동에 tuptime 명령을 사용하는 방법을 살펴 보았습니다. 이 명령은 사용이 간단하며 가이드의 내용을 이해하지 못하는 경우 의견을 게시하거나 내가 모은 정보를 추가 할 수 있습니다. Tecmint와 연결을 유지하는 것을 잊지 마십시오.

참조 : tuptime 홈페이지