Good morning, Harald, On Fri, 2 Oct 2009, Harald Linden wrote:
Somebody above suggested that I use Batik instead of Inkscape - well, that doesn't work at all and fails with an error message about some missing file in the lib directory. Anyway, I assume, I'm not alone with my Inkscape-related trouble. How about somebody throws together a small script that monitors the cpu-time of running inkscape sessions and kills them off after a certain amount has been used? I've just come home again to find tah hanging due to an inkscape error. The machine hasn't been very productive during the last two days because of that.
An alternate approach is to kill off inkscape when it has run longer than a given amount of wall-clock time. The "timeout" program, bundled with the netatalk package on Linux, will do that.
Perhaps:
yum install netatalk || apt-get install netatalk
and
timeout -s TERM 1800 /usr/bin/inkscape
I'd suggest using a wrapper like the following (identical script
compressed and attached), and placing it in a directory in your path
searched before /usr/bin (where inkscape is found on my system; "echo
$PATH" and look for a dir before /usr/bin). My proposed wrapper for
/usr/local/bin/inkscape follows my sig block.
The script has sections that you can comment or uncomment to 1)
lower cpu priority with renice, 2) lower disk priority with ionice, 3)
only allow a single copy of inkscape to run at a time, and 4) run
inkscape, killing it off after a maximum number of wall-clock seconds.
It might need customization for your needs, but should be pretty
close to run-out-of-the-box.
Cheers,
- Bill
---------------------------------------------------------------------------
'SYN! .. SYN|ACK! .. ACK!' - the mating call of the internet
(Courtesy of Bert Hubert <[email protected]>)
--------------------------------------------------------------------------
William Stearns ([email protected], tools and papers: www.stearns.org)
Top-notch computer security training at www.sans.org , www.giac.net
--------------------------------------------------------------------------
#!/bin/bash
#Copyright 2009 William Stearns <[email protected]>
#Released under the GPL.
#This is the max number of (wall-clock) seconds to allow inkscape to
#run.
MaxInkscapeSeconds=3600
requireutil () {
while [ -n "$1" ]; do
if ! type -path "$1" >/dev/null 2>/dev/null ; then
echo Missing utility "$1". Please install it. >&2
return 1 #False, app is not available.
fi
shift
done
return 0 #True, app is there.
} #End of requireutil
Cleanup () {
#echo Cleaning up #Debug only
rm -f /tmp/.inkscape-lockfile
}
requireutil inkscape rm sleep timeout touch
#renice and ionice not required; if missing, we only get a warning and
#run at normal priority
#Optional; if you uncomment the renice line, inkscape will run with
#lower cpu priority. 1 (slightly lower) to 19 (lowest priority)
renice 16 $$ >/dev/null 2>&1
#Optional; if you have ionice installed and set up in sudo to
#allow it to run with NOPASSWD, you can lower its disk priority. Less
#of an issue, as inkscape is not an IO hog.
#sudo ionice -c3 -p$$ >/dev/null 2>&1
#Optional; The next block allows only one copy of inkscape running
#at a time; additional copies will wait for the first to finish.
#If you shut the system down while inkscape is running or stop
#inkscape with Ctrl-C, the lockfile might still be there; perhaps
#put this line at the end of /etc/rc.d/rc.local :
# rm -f /tmp/.inkscape-lockfile
touch /tmp/.inkscape-lockfile
while [ -s /tmp/.inkscape-lockfile ]; do
#echo -n '_' #Debug only
sleep $[ $RANDOM / 512 ] #1 to 63 seconds
done
#Try to clean up the lockfile if Ctrl-C pressed or on exit
trap Cleanup SIGINT 0
echo 'Inkscape is running' >/tmp/.inkscape-lockfile
timeout -s TERM "$MaxInkscapeSeconds" /usr/bin/inkscape $*
#timeout -s TERM "$MaxInkscapeSeconds" sleep 72 #Debug only
inkscape.wrapper.v0.1.gz
Description: inkscape.wrapper.v0.1.gz
_______________________________________________ Tilesathome mailing list [email protected] http://lists.openstreetmap.org/listinfo/tilesathome
