I have the latest unstable running with -Xmx256m, which gives 320 MiB. Maximum memory the JVM will allocate 320 MiB. It keeps running out of memory, and it's attempts to recover fail. So, I wrote the following one-liner to start freenet:
(while true; do date;
./stop-freenet.sh;
./update-unstable.sh;
./start-freenet.sh 2>&1 \
| tee /dev/tty \
| grep -l OutOfMemoryError && \
(date; sleep 30; date; ./stop-freenet.sh; sleep 60);
done &)
The outer parens avoid bash job control.
update-unstable.sh is shown below, a modification of update.sh.
The important part is the pipeline. It lets output messages
still appear on the terminal but also searches the output
for the string 'OutOfMemoryError'. Should this appear on
the output, the grep command exits, but freenet keeps running.
First try I had a ';' where the '&&' appears -- that didn't
work. When grep exits after finding the OutOfMemoryError,
with success, the second part of the command takes over,
and runs stop-freenet.sh. This kills freenet, permitting
the pipeline to exit, and the process starts over with
a redundant stop-freenet.sh, a download of the latest
unstable build, and start-freenet.sh.
#!/bin/sh
# timestamping sets the correct date on the retrieved file and avoids
# retrieving it if the remote date is not newer. Does not work correctly
# together with the -O option for specifying a new output filename.
cp -pf freenet-unstable.jar freenet-unstable-latest.jar
wget --timestamping http://freenetproject.org/snapshots/freenet-unstable-latest.jar
# test -s FILE
# FILE exists and has a size greater than zero
if test -s freenet-unstable-latest.jar; then
# if new file is different from the old one, make backup.
if ! cmp freenet-unstable-latest.jar freenet-unstable.jar; then
mv -f freenet-unstable.jar freenet-unstable-old.jar
echo 'old freenet-unstable.jar saved'
fi
# always use the date/time from the project site.
mv freenet-unstable-latest.jar freenet-unstable.jar
else
rm -f freenet-unstable-latest.jar
fi
--
Edward J. Huff <[EMAIL PROTECTED]>
signature.asc
Description: This is a digitally signed message part
_______________________________________________ Devl mailing list [EMAIL PROTECTED] http://dodo.freenetproject.org/cgi-bin/mailman/listinfo/devl
