[vhffs-dev] [1257] add the ability to set the nice level before running the cron job

[ Thread Index | Date Index | More vhffs.org/vhffs-dev Archives ]


Revision: 1257
Author:   gradator
Date:     2008-09-25 18:39:55 +0200 (Thu, 25 Sep 2008)

Log Message:
-----------
add the ability to set the nice level before running the cron job

Modified Paths:
--------------
    trunk/vhffs-backend/conf/vhffs.conf.dist.in
    trunk/vhffs-robots/src/cron_scheduler.pl


Modified: trunk/vhffs-backend/conf/vhffs.conf.dist.in
===================================================================
--- trunk/vhffs-backend/conf/vhffs.conf.dist.in	2008-09-25 16:19:57 UTC (rev 1256)
+++ trunk/vhffs-backend/conf/vhffs.conf.dist.in	2008-09-25 16:39:55 UTC (rev 1257)
@@ -476,6 +476,9 @@
 		# Maximum execution time (in seconds)
 		max_execution_time	=	7200
 
+		# Run processes at a nice level ?
+		nice		=	19
+
 		# System limits
 		<limits>
 			# Default configuration is for Linux 2.6
@@ -483,7 +486,7 @@
 			# $ perl -e 'use BSD::Resource; print join( "\n" , keys %{get_rlimits()} )."\n"';
 			#
 			# resource = soft hard
-			RLIMIT_CPU = 900 900
+			RLIMIT_CPU = 3600 3600
 			RLIMIT_FSIZE = RLIM_INFINITY RLIM_INFINITY
 			RLIMIT_DATA = 104857600 104857600
 			RLIMIT_STACK = 4194304 4194304

Modified: trunk/vhffs-robots/src/cron_scheduler.pl
===================================================================
--- trunk/vhffs-robots/src/cron_scheduler.pl	2008-09-25 16:19:57 UTC (rev 1256)
+++ trunk/vhffs-robots/src/cron_scheduler.pl	2008-09-25 16:39:55 UTC (rev 1257)
@@ -63,6 +63,7 @@
 my $rlimits = BSD::Resource::get_rlimits();
 my $mailcronfrom = $cronconf->{'mail_from'};
 my $maxexectime = $cronconf->{'max_execution_time'};
+my $nice = $cronconf->{'nice'};
 
 my %jobs;
 my %fd2jobs;
@@ -284,6 +285,7 @@
 			BSD::Resource::setrlimit( $resource , $soft, $hard ) if defined $resource and defined $soft and defined $hard;
 		}
 
+		POSIX::nice $nice;
 		POSIX::setgid $cron->get_owner_gid;
 		POSIX::setuid $cron->get_owner_uid;
 		return 1 unless( getuid() == $cron->get_owner_uid && getgid() == $cron->get_owner_gid );


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/