imagemagick time limit
imagemagick time limit
Is there a posibility to set a timeout (time limit) for imagemagick (convert in special)?. I have seen limitations for disk, memory ...., but not for time.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
IM itself will probably never have such a limit, as it could only practically do it between 'options' and not during a actual processing step, and it is the processing step that can take a long time. It also can be locked up in a I/O call, which is has no control over.
You can however do a timeout in the calling program!!!
For example I can do this in a bourne/bash shell..}
You can see more about this and other tries to do this in my shell script notes
http://www.cit.gu.edu.au/~anthony/info/ ... ript.hints
and look for "Command timeout". Other API's have other simular methods.
You can however do a timeout in the calling program!!!
For example I can do this in a bourne/bash shell..
Code: Select all
TIMEOUT=60
timeout_convert() {
# lookup the users disk quota but with a timeout
convert "$@" &
# now ensure that the above command does not run too long
cmd_pid=$!
( sleep $TIMEOUT
echo >&2 "Quota Timeout"
kill -9 $cmd_pid 2>/dev/null
) &
kill_pid=$!
wait $cmd_pid
kill $kill_pid 2>/dev/null
You can see more about this and other tries to do this in my shell script notes
http://www.cit.gu.edu.au/~anthony/info/ ... ript.hints
and look for "Command timeout". Other API's have other simular methods.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/