psacct & checkinstall 使用備忘

来源:百度文库 编辑:神马文学网 时间:2024/04/24 03:42:41
psacct & checkinstall 使用備忘
psacct - 監視系統資源使用狀況CheckInstall - 把 tarball source 變成 rpm、deb 封裝的好工具
環境: Fedora Core 1 Linux
psacct - 監視系統資源使用狀況
安裝 psacct 套件
CentOS / Fedora Core Linux: yum install psacct Ubuntu / Debian Linux: apt-get install acct (SuSE 也是 acct)
啟用 psacct 服務
chkconfig psacct on /etc/init.d/psacct start
ac - 統計使用者連線時間 (單位: 小時)
ac -d 依日期統計 ac -p 依使用者帳號統計 ac -f /var/log/wtmp.1 指定來源檔案 (預設 /var/log/wtmp)
lastcomm - 列示執行過的程序 (process)
需啟動 psacct 服務: /etc/init.d/psacct start 資料檔案: /var/account/pacct 顯示格式: 指令名稱 旗標
S -- command executed by super-user
F -- command executed after a fork but without a following exec
C -- command run in PDP-11 compatibility mode (VAX only)
D -- command terminated with the generation of a core file
X -- command was terminated with the signal SIGTERM (usually Ctrl + C) 執行者帳號 終端機名稱 CPU 執行時間
常用參數: 在 lastcomm 後面加上: 指令名稱、帳號、終端機名稱
ex. lastcomm rm; lastcomm root; lastcomm pts/1
sa - 統計執行過的程序
需啟動 psacct 服務: /etc/init.d/psacct start 資料檔案: /var/account/pacct 顯示格式: 該程序執行次數 已執行時間 (單位: 分鐘) CPU 處理時間 (單位: 分鐘) 以 CPU 時間平均計算的記憶體使用量 程序名稱
sa -a 顯示所有程序記錄 sa -m 依使用者統計
Reference:
nixCraft - How to keep a detailed audit trail of what‘s being done on your Linux systems
CheckInstall - 把 tarball source 變成 rpm、deb 封裝的好工具
以安裝proftpd 為例
wgetftp://ftp.proftpd.org/distrib/source/proftpd-1.3.0.tar.bz2
tar jxf proftpd-1.3.0.tar.bz2
cd proftpd-1.3.0
./configure
make
checkinstall
The package documentation directory ./doc-pak does not exist.
Should I create a default set of package docs? [y]: (Press Enter)
Please choose the packaging method you want to use.
Slackware [S], RPM [R] or Debian [D]? R
Please write a description for the package.
End your description with an empty line or EOF.
>> (press Enter to skip this step)
rpm -ivh --nomd5 /usr/src/redhat/RPMS/i386/proftpd-1.3.0-i386.rpm
ps. 不知怎麼的, 以 checkinstall 產生的 rpm 檔安裝時會出現 MD5 sum mismatch 錯誤, 只好以 --nomd5 參數省略 md5 checksum 驗証.
Reference:
CheckInstall 官方網頁Hiweed‘s blog - 好用的工具checkinstall
Posted by Jamyy at 2006年11月17日 17:30
from: http://cha.homeip.net/blog/archives/2006/11/psacct_checkins.html