Skip to content

Instantly share code, notes, and snippets.

@Nitrodist
Created October 26, 2012 21:32
Show Gist options
  • Save Nitrodist/3961690 to your computer and use it in GitHub Desktop.
Save Nitrodist/3961690 to your computer and use it in GitHub Desktop.
#!/bin/bash
line_count=0
text_to_send=""
number_of_lines_to_send_at_a_time=5
logfile="irclogs/freenode/#skullspace.log"
mailing_to="discuss@lists.skullspace.ca"
tail -f -n 0 $logfile | \
while read line
do
text_to_send="$text_to_send\n$line"
line_count=$((line_count+1))
if [[ $line_count -eq $number_of_lines_to_send_at_a_time ]]
then
echo "Sending mail to $mailing_to after $number_of_lines_to_send_at_a_time lines typed"
echo -e $text_to_send | mail -s "SkullSpace IRC Discuss Pipe! $(date)" $mailing_to
text_to_send=""
line_count=0
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment