Skip to content

Commit

Permalink
add modification for macos too
Browse files Browse the repository at this point in the history
  • Loading branch information
kermitt2 committed Aug 6, 2023
1 parent 3de1ca4 commit b6675db
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion grobid-home/pdfalto/lin-64/pdfalto_server
Expand Up @@ -6,7 +6,7 @@ timeout=20 # 20 seconds
interval=1
# Delay between posting the SIGTERM signal and destroying the process by SIGKILL.
delay=0
# Limit the memory usage by this bash script
# Default limit for the memory usage by this bash script
memory_limit=6242304

command=${0:0:${#0}-7}
Expand Down
11 changes: 10 additions & 1 deletion grobid-home/pdfalto/mac-64/pdfalto_server
Expand Up @@ -6,8 +6,10 @@ timeout=20 # 20 seconds
interval=1
# Delay between posting the SIGTERM signal and destroying the process by SIGKILL.
delay=0
command=${0:0:${#0}-7}
# Default limit for the memory usage by this bash script
memory_limit=6242304

command=${0:0:${#0}-7}
args=("$@")
pdfalto_params=()

Expand All @@ -17,12 +19,19 @@ for ((n=0; n<="$#";n++)); do
timeout=${args[n+1]}
((n++))
;;
--ulimit)
memory_limit=${args[n+1]}
((n++))
;;
*)
pdfalto_params+=" ${args[n]}"
;;
esac
done

# Limit the memory usage by this bash script
ulimit -Sv $memory_limit

# kill -0 pid Exit code indicates if a signal may be sent to $pid process.
(
((t = timeout))
Expand Down

0 comments on commit b6675db

Please sign in to comment.