#! /bin/bash
NNTP=nntpread

function age() {
	mv $1.3 $1.4
	mv $1.2 $1.3
	mv $1.1 $1.2
	mv $1 $1.1
}

cd ~/n

while (true)
#	echo getting michael\'s  mail....
#	getmail
#	echo getting moira\'s mail.... 
#	m_mail
	echo getting news...
	/root/n/find.new
	do
	PID=`slink 119 uniwa:119 | tail -1`
	echo $PID
	$NNTP xavier > a.x < act.uniwa
	if [ -s a.x ]; then
		age act.uniwa
		mv a.x act.uniwa
	fi
su news <<end_end
/usr/lib/newsbin/input/newsrun
end_end
	echo done uniwa...
	kill $PID
sleep 60

	PID=`slink 119 bilby.cs:119 | tail -1`
	echo $PID
	$NNTP xavier > a.x < act.bilby
	if [ -s a.x ]; then
		age act.bilby
		mv a.x act.bilby
	fi
	
su news <<end_end
/usr/lib/newsbin/input/newsrun
end_end
	echo done bilby.cs...
	kill $PID
	
	sleep 1000
done



