Submitted by tensai on
I get the infrequent comment spam posted to the site. Actually, I added the "Recent comments" box to the left side of the sight specifically so I could monitor the situation. Plus I enjoy reading what you guys have to say. In an attempt to limit the former without unnecessarily burdening the latter I have written a crontab to update all my blog posts to set comments to read-only after 4 months. I hope that's enough time for feedback from everybody. Let me know if you feel otherwise.
For the curious, here's the script:
#!/bin/sh
echo "update node set comment = '1' where comment = '2' and unix_timestamp(now()) > changed and unix_timestamp(now()) - changed > 10368000 order by from_unixtime(changed);" | mysql -u comments -ppassword blog
And I created a special user just for this task:
mysql> grant update,select on blog.node to comments@localhost identified by 'password';
And added it to the system crontab:
15 2 * * * nobody /usr/local/bin/disable-comments.sh
Recent comments