#! /bin/bash

dir=/home/www/potorti.it/pot/fidocad
script=$dir/fidocad.bash
timeout=60			# kill it after timeout

# Remove images generated more than 2 minutes ago
find $dir -name fidocad-'[0-9]*.*' -mmin +2 -exec rm '{}' \; &

ulimit -c 0			# no core files
ulimit -d 4000000		# 4 GB memory
ulimit -f 1000			# 500 KB disk
ulimit -u 60			# 60 threads

/usr/bin/timeout $timeout $script
