Created
May 10, 2012 20:15
-
-
Save 0xAether/2655599 to your computer and use it in GitHub Desktop.
Simple script to clean up Minecraft log files from the "Can't keep up" messages.
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
#!/usr/bin/env bash | |
# Cleans up Minecraft log files from those pesky "Can't keep up" messages. | |
if [ $# -gt 1 ] || [ $# = 0 ] | |
then | |
echo 'This script requires one argument. That should be the name of the log file.' | |
exit 2 | |
else | |
: | |
fi | |
if [ -e $1 ] | |
then | |
: | |
else | |
echo 'File doesn`t exist. Derp.' | |
exit 2 | |
fi | |
if lsof $1 >& /dev/null | |
then | |
echo 'Log file is in use. Stop the server that is using the file and try again.' | |
exit 1 | |
else | |
: | |
fi | |
sed '/^[0-9][0-9][0-9][0-9]-[0-9][0-9]-[0-9][0-9] [0-9][0-9]:[0-9][0-9]:[0-9][0-9] \[WARNING\] Can.t keep up\! Did the system time change\, or is the server overloaded?$/d' $1 > cleanedup | |
rm $1 | |
mv cleanedup $1 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment