shithub: rc

ref: c1a707427fbbb5129e467516fc671e976ee3e398
dir: /rrss.barf/

View raw version
#!/bin/rc
# 2024-08-27T22:47:32-04:00
# Dump RSS feeds into werc/apps/barf entries.
# Run from cron.
rfork en
name=$1
if(! ~ $name read tumblr){
	echo guess again. >[1=2]
	exit usage
}
log=/sys/log/$name.err
root=/usr/sl/www/werc/sites/$name.stanleylieber.com
urls=/usr/sl/lib/$name
bind -c /sys/log/read.links $root/links
>$log
{
	while(){
		sleep 30
		if(ps | grep -s -e 'Broken[ ]+rrss'){
			{date; echo Kill Broken rrss} >>$log
			Kill rrss | rc
		}
		sleep 30
		if(ps | grep -s -e 'Sleep[ ]+rrss'){
			{date; echo Kill Sleep rrss} >>$log
			Kill rrss | rc
		}
	}
} &
ofs=$ifs
ifs='
' {
	for(i in `{cat $urls}){
		ifs=$ofs {
			j=`{echo $i}
			url=$j(1)
			tag=$j(2-)
		}
			echo $"url $"tag >>$log
			alarm 30 rrss -f barf -r $root -t $"tag -u $"url >>[2]$log ||
				echo $"url FAIL >>$log
	}
}
for(i in `{walk $root/src}){ chgrp www $i }
echo ',s/^$\n//g; w; q' | sam -d $root/links
{date; echo Kill rrss.barf} >>$log
Kill rrss.barf | rc