add function crtime
This commit is contained in:
parent
00f3537187
commit
023d0a036d
1 changed files with 10 additions and 0 deletions
10
functions.sh
10
functions.sh
|
@ -886,4 +886,14 @@ EOF
|
|||
rescan_scsi () {
|
||||
echo "- - -" > /sys/class/scsi_host/host0/scan
|
||||
}
|
||||
|
||||
get_crtime() {
|
||||
for target in "${@}"; do
|
||||
inode=$(stat -c %i "${target}")
|
||||
fs=$(df --output=source "${target}" | tail -1)
|
||||
crtime=$(sudo debugfs -R 'stat <'"${inode}"'>' "${fs}" 2>/dev/null |
|
||||
grep -oP 'crtime.*--\s*\K.*')
|
||||
printf "%s\t%s\n" "${target}" "${crtime}"
|
||||
done
|
||||
}
|
||||
#EOF
|
||||
|
|
Loading…
Reference in a new issue