#!/bin/rc # lists: sync mailing lists # example: # ; lists 9front # sync 9front list # ; upas/fs -f /tmp/lists/9front # mount /mail/fs # ; mail -r # read list rfork e host=9front.org dir=/tmp/lists n=0 switch($#*){ case 0 echo usage: lists list ... >[1=2] exit usage } 9fs $host for(i){ src=/n/$host/lists/$i if(! test -d $src){ echo $src not found >[1=2] exit 'not found' } dst=$dir/$i echo $src '->' $dst mkdir -p $dst for(j in `{comm -23 <{ls -p $src} <{ls -p $dst}}){ echo $j cp -x $src/$j $dst & n=`{echo $n + 1 | bc} if(~ `{echo $n % 4 | bc} 0) wait } echo $i total: $n } wait unmount /n/$host rm /srv/$host