#!/bin/bash BASE_URL=http://marc.merlins.org SPOOL=/home/merlin/rig3/linkpost/ YEAR=`date +%Y` MONTH=`date +%m` MONTH2=$(echo 0$(expr $MONTH - 1) | sed "s/.*\(..\)$/\1/") #YEAR=2011 #MONTH=01 #EMAIL=ykw3ki@ping.fm # http://www.facebook.com/mobile/ EMAIL=fresh783yak@m.facebook.com,magicien@merlins.org,citybelle@gmail.com #EMAIL=fresh783yak@m.facebook.com #EMAIL=marc@merlins.org BCC=marc@merlins.org for fullpost in `find blog myblog | egrep "/post_$YEAR-($MONTH|$MONTH2)" | sort` do post="${fullpost/*\//}" test -f "$SPOOL/$post" && continue if grep -q 'izu:misc:nofb' $fullpost; then echo "nofb tag: skipping $url" continue fi title=`cat $fullpost | perl -e '$_ = join("", ); s/.*title="Permalink.*?.+?<\/span>(.*?)<\/a>.*/\1/ism; s/^\s+(.*?)\s+$/\1/; print "$_"'` url=`echo $BASE_URL/$fullpost | sed -e "s#blog/cat#perso#" -e "s#/myblog/#/mb/#"` cat=`echo $url | perl -e '$_ = join("", ); s#.*/perso/(.*?)/.*#\u$1# and print $_'` test -z $cat && cat="Personal" str="$cat Blog Post| $title: $url" echo $str #echo $str | mail -a "content-type: text/plain; charset=utf-8" -b $BCC $EMAIL echo $str | mail -a "Content-Type: text/plain; charset=utf-8" -s "$str" -b $BCC $EMAIL touch "$SPOOL/$post" done # vim:sts=4:sw=4