Created
December 14, 2015 13:00
-
-
Save adamamyl/68b2ba71c166abe466da to your computer and use it in GitHub Desktop.
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/bash | |
| # | |
| # diskcheck-on-reboot: | |
| # | |
| # Copyright (c) 2012 root. All rights reserved. | |
| # | |
| # | |
| # $Id$ | |
| # | |
| #set -x | |
| OF=/tmp/diskcheck-on-reboot$RANDOM$RANDOM | |
| echo Partition*NextCheckDate*CheckInNdays > ${OF} | |
| for M in `mount -l -t ext2,ext3 | cut -d" " -f1` | |
| do | |
| NXTCHCK=`tune2fs -l ${M} | \ | |
| grep ^Next | sed 's/after:/after^/' | \ | |
| awk -F^ '{print $NF}' | sed 's/^[ \t]*//;s/[ \t]*$//'` | |
| #ANDNOW=`date '+%a %b %e %T %Y'` | |
| NOWIS=`date '+%s'` | |
| NEXTCHECK=$(date --date="$NXTCHCK" +%s) | |
| #DATEMATH=`echo $"( ( "$NOWIS" ) - ( "$NEXTCHECK" ) ) / (60*60*24)" | bc` | |
| DATEMATH=`echo $"( ( "$NEXTCHECK" ) - ( "$NOWIS" ) ) / (60*60*24)" | bc` | |
| echo ${M}*${NXTCHCK}*${DATEMATH} >> ${OF} | |
| done | |
| column -s\* -t ${OF} | |
| rm ${OF} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment