I have a perl script which runs from a cron job. How would you limit the amount of RAM that this script is allowed to consume? Is there a ulimit setting that will accomplish this? If so does ulimit have to be run each time the script is run, or is there a way to set it permanently?
Dear Fellows: I'm under a proxy server (squid) and I need to update my centos but every time that I run yum -y update tells me that I can no find a file that exists. The problems is that this machine that I'm trying to update has no graphic shell, so I need to make all by console. Saludos Fraternales _____________________________ Atte. Alberto Garc?a G?mez M:.M:. Administrador de Redes/Webmaster IPI "Carlos Marx", Matanzas. Cuba. ----- Original Message ----- From: "Sean Carolan" <scarolan at gmail.com> To: "CentOS mailing list" <centos at centos.org> Sent: Monday, July 20, 2009 11:28 AM Subject: [CentOS] Limit RAM used by a perl script>I have a perl script which runs from a cron job. How would you limit > the amount of RAM that this script is allowed to consume? Is there a > ulimit setting that will accomplish this? If so does ulimit have to > be run each time the script is run, or is there a way to set it > permanently? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos
On Mon, Jul 20, 2009 at 4:28 PM, Sean Carolan<scarolan at gmail.com> wrote:> I have a perl script which runs from a cron job. ?How would you limit > the amount of RAM that this script is allowed to consume? ?Is there a > ulimit setting that will accomplish this? ?If so does ulimit have to > be run each time the script is run, or is there a way to set it > permanently? > _______________________________________________ > CentOS mailing list > CentOS at centos.org > http://lists.centos.org/mailman/listinfo/centos >If you run it as a regular user, then maybe you can check out /etc/security/limits.conf
On 07/20/2009 05:28 PM, Sean Carolan wrote:> I have a perl script which runs from a cron job. How would you limit > the amount of RAM that this script is allowed to consume? Is there a > ulimit setting that will accomplish this? If so does ulimit have to > be run each time the script is run, or is there a way to set it > permanently?First, install the perl module BSD::Resource yum install perl-BSD-Resource Then use it in your program like: #!/usr/bin/perl use BSD::Resource; setrlimit(RLIMIT_VMEM, 1_000_000, 1_000_000); # rest of the program that is limited to 1MByte now -- Paul