>>214
The patch is back. There's a recent improvement that you could add too. The data
dir is now under version control with two little scripts in ~/bin
cat ~/bin/onchange
#!/bin/sh
#
# Watch current directory (recursively) for file changes, and execute
# a command when a file or directory is created, modified or deleted.
#
# Written by: Senko Rasic <senko.rasic@dobarkod.hr>
#
# Requires Linux, bash and inotifywait (from inotify-tools package).
#
# To avoid executing the command multiple times when a sequence of
# events happen, the script waits one second after the change - if
# more changes happen, the timeout is extended by a second again.
#
# Installation:
# chmod a+rx onchange.sh
# sudo cp onchange.sh /usr/local/bin
#
# Example use - rsync local changes to the remote server:
#
# onchange.sh rsync -avt . host:/remote/dir
#
# Released to Public Domain. Use it as you like.
#
EVENTS="CREATE,CLOSE_WRITE,DELETE,MODIFY,MOVED_FROM,MOVED_TO"
if [ -z "$1" ]; then
echo "Usage: $0 cmd ..."
exit -1;
fi
inotifywait -e "$EVENTS" -m --exclude '/\.' -r --format '%:e %f' . | (
WAITING="";
while true; do
LINE="";
read -t 1 LINE;
if test -z "$LINE"; then
if test ! -z "$WAITING"; then
echo "CHANGE";
WAITING="";
fi;
else
WAITING=1;
fi;
done) | (
while true; do
read TMP;
echo $@
$@
done
)
This one is obviously not mine, I have just added -exclude '/\.
to avoid getting the .git
dir itself tracked.
cat ~/bin/gitcommit
#!/bin/sh
git add --all
git commit -a -m "new post"
Then if you run onchange gitcommit
in the data
dir (or only in sexp
dir) you can reverse spamming attacks. Do not believe the comments in onchange
the script runs perfectly fine on FreeBSD and tcsh
. You just need to install inotify-tools
and add ~/bin
to the PATH.
The onchange
scripts can be used for many other things. In the first months I've launched textboard.org I was totally offline and it was sending me a SMS on new messages, it was quickly shut down because I had no opportunity to sit on a computer at the time and it was just depressing.