Created
May 8, 2015 20:33
-
-
Save omar-yassin/83bdd9cbce2846a68d37 to your computer and use it in GitHub Desktop.
BASH SKELETON: Read from file from the last place you left off
This file contains 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
## incomplete; just a guide so I can remember | |
$log_file | |
last_length = `cat /tmp/${log_file}_last_length` | |
current_legnth = 'wc -c $log_file' | |
if [[ $last_file_length > 0 ]] ; then | |
diff_length = current_length - last_length | |
if [[ diff_length >= 0 ]] ; then | |
## DO WHAT EVER AROUND HERE - should only tail file from where it last read | |
tail -c +$last_length+1 $log_file | |
fi | |
fi | |
echo $current_legth > /tmp/${log_file}_last_length |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment