Created
August 17, 2016 06:23
-
-
Save tripleee/2a1622fdf8ab080ce3b36d95af60010a to your computer and use it in GitHub Desktop.
starttime - print start time of a process on Linux
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# http://stackoverflow.com/a/38740102/874188 | |
for p; do | |
printf "/proc/%i/stat\0" "$p" | |
done | | |
xargs -r0 awk -v ticks="$(getconf CLK_TCK)" 'NR==1 { now=$1; next } | |
{ print strftime("%c " $1 " " $2, systime() - (now-($22/ticks))) } | |
' /proc/uptime |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment