Created
July 15, 2010 00:57
-
-
Save lsdr/476348 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/sh | |
# | |
# Stupid script that handles big Rails logs in search for activation emails queued on DelayedJobs. | |
# Like I said, stupid. No more than the bug that created the need to do this, but still. | |
# | |
# And nevermind the name. I decided to look the web for inspiration and got an article on Ford, | |
# Chrysler and Lee Iacocca. Thus, iacocca.sh. | |
# | |
echo "spliting log file in 30M tempfiles..." | |
split -b 30000000 $1 | |
LOG_LIST=$(ls -1 x* | xargs) | |
USER_IDS=`pwd`/user_ids | |
for LOG in $LOG_LIST; do | |
echo "processing: $LOG" | |
grep -i delayed $LOG \ | |
| grep -i create \ | |
| grep -i activate \ | |
| awk '/AR\:User\:([0-9]*)/ {print $32}' | \ | |
sed 's/AR\:User\://' | sed 's/\\n\-//' >> $USER_IDS | |
echo " done $LOG, moving on..." | |
done | |
echo "removing tempfiles" | |
rm -fr x* | |
echo | |
echo "Success! Total of $(wc -l $USER_IDS)" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment