ps -eo lstart 启动时间
ps -eo etime 运行多长时间.
ps -eo pid,lstart,etime | grep PID
ps -eO lstart |grep ''
写个小脚本,根据传入的参数显示对应进程的启动时间
比如运行:./show.sh mysql 显示mysql进程的启动时间:
- #!/bin/bash
- if [ -z $1 ]; then
- echo "please input ps keyword" && exit 1
- fi
- ps aux |grep $1 |grep -v "grep $1" |grep -v " $1" |while read line
- do
- linewords=($line)
- pid="${linewords[1]}"
- START_TIME=$(ps -p ${pid} -o lstart | grep -v "START")
- echo "$line $START_TIME"
- done