Skip to content

Instantly share code, notes, and snippets.

@0xAether
Created May 10, 2012 20:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save 0xAether/2655599 to your computer and use it in GitHub Desktop.
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.
#!/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