0

I want all child processes of my perl script to generate core files in case of unexpected failures. So how can I set ulimit to unlimited inside perl?

Mihran Hovsepyan
  • 10,810
  • 14
  • 61
  • 111
  • Try BDS::Resource. http://stackoverflow.com/questions/2226329/how-do-i-set-a-ulimit-from-inside-a-perl-script-that-applies-to-its-children – Tim A Nov 06 '12 at 17:00
  • I don't wan't to use external dependencies. – Mihran Hovsepyan Nov 06 '12 at 17:06
  • can you explain why not? – ysth Nov 06 '12 at 17:25
  • The script is a part of our distribution. So taking into account that not small part of perl distributions doesn't support BDS we sometimes will have to ask to our costumers to install a new perl distribution which is not enough good. – Mihran Hovsepyan Nov 07 '12 at 08:24

1 Answers1

2

You have to change the openfiles parameters of the user that launch your perl script. So you can change the limit on-the-fly with:

ulimit -n unlimited && perl path/to/your/script.pl

Or you can make a bash script foo.sh:

#!/bin/bash
ulimit -n unlimited
perl path/to/your/script.pl
Flat
  • 1,640
  • 1
  • 12
  • 14