#!/bin/bash # version 1.1 hn=$(hostname) place=$(hostname | awk -F'.' '{print $1}') # https://mail.loni.org/mailman/admin/LIST-NAME # place can be emac3, scusa0, hpc, lonimail rsyncDest="rsync://isaac.lsu.edu/mailman-${place}" LISTS='/usr/lib/mailman/bin/list_lists' MEMBERS='/usr/lib/mailman/bin/list_members' CONFIG='/usr/lib/mailman/bin/config_list' PARENT='/tmp/html' dest="${PARENT}/${place}" idx="${dest}/index.html" allSubscribers="${PARENT}/all.txt" users="${PARENT}/people.txt" usersHtml="${dest}/people.html" rm -rf ${PARENT} mkdir -p ${dest} echo "Generating html..." echo "" > ${idx} echo "" >> ${idx} echo "

Mailing List Reports for ${place}

" >> ${idx} echo "
People and the mailing lists they are subscribed to
" >> ${idx} echo "" >> ${idx} echo "" >> ${idx} ${LISTS} | grep -v 'matching mailing lists found' | sort -u | while read line do echo " Processing: ${line}" name=$(echo ${line} | awk '{print $1}') desc=$(echo ${line} | sed "s/^${name} - //") cfgName="${name}-config.html" cfg="${dest}/${cfgName}" admin="http://${hn}/mailman/admin/${name}" cnt=$(${MEMBERS} -f ${name} | sort -u | wc -l) echo "" >> ${idx} # now make html file of members of each list lst="${dest}/${name}.html" echo "" > ${lst} echo "" >> ${lst} echo "

${name} on ${place}

" >> ${lst} echo "

" >> ${lst} echo "

List
Name
Member
addresses
Member
Count
Mailman
Admin
Text
Config
Decription
${name}${cnt}membersadminconfig${desc}
" >> ${idx} echo "
Page generated $(date)
" >> ${idx} echo "" >> ${idx} echo "" >> ${idx} # now make list by subscriber sort ${allSubscribers} > ${allSubscribers}.sort cat ${allSubscribers}.sort | awk -F'|' '{print $1}' | sort -u > ${users} echo "Generating html for people list..." echo "" > ${usersHtml} echo "" >> ${usersHtml} echo "

List of all subscribers and the lists they belong to

" >> ${usersHtml} echo "" >> ${usersHtml} echo "
" >> ${usersHtml} echo "
Page generated $(date)
" >> ${usersHtml} echo "" >> ${usersHtml} echo "" >> ${usersHtml} echo "Pushing html to server" rsync -avr -4 ${dest}/ ${rsyncDest}/ rm -rf ${PARENT}