mirror of
https://github.com/webmin/webmin.git
synced 2026-05-26 08:00:31 +01:00
Nice level for cron jobs
This commit is contained in:
@@ -2570,10 +2570,21 @@ else {
|
||||
}
|
||||
|
||||
# Set the umask based on config
|
||||
if ($gconfig{'umask'}) {
|
||||
if ($gconfig{'umask'} && !$main::umask_already++) {
|
||||
umask(oct($gconfig{'umask'}));
|
||||
}
|
||||
|
||||
# If this is a cron job or other background task, set the nice level
|
||||
if (!$main::nice_already && !$ENV{'SCRIPT_NAME'} && $gconfig{'nice'} &&
|
||||
$gconfig{'os_type'} ne 'windows') {
|
||||
# Cron jobs have no tty
|
||||
if (!open(TTY, ">/dev/tty")) {
|
||||
eval 'use POSIX; POSIX::nice($gconfig{\'nice\'});';
|
||||
}
|
||||
close(TTY);
|
||||
}
|
||||
$main::nice_already++;
|
||||
|
||||
# Get the username
|
||||
local $u = $ENV{'BASE_REMOTE_USER'} ? $ENV{'BASE_REMOTE_USER'}
|
||||
: $ENV{'REMOTE_USER'};
|
||||
|
||||
@@ -70,3 +70,4 @@ Added a field to the Advanced Options page to control the number of days that fi
|
||||
The format for dates displayed by Webmin can be changed by a new option on the User Interface page.
|
||||
---- Changes since 1.380 ----
|
||||
Inheritance of the system path into Webmin's search path can be set on the Operating System and Environment page.
|
||||
The nice level (CPU priority) of all cron and other background jobs run by Webmin can now be set on the Advanced Options page.
|
||||
|
||||
@@ -51,6 +51,14 @@ else {
|
||||
$gconfig{'umask'} = $in{'umask'};
|
||||
}
|
||||
|
||||
# Save nice level
|
||||
if ($in{'nice_def'}) {
|
||||
delete($gconfig{'nice'});
|
||||
}
|
||||
else {
|
||||
$gconfig{'nice'} = $in{'nice'};
|
||||
}
|
||||
|
||||
&lock_file("$config_directory/config");
|
||||
&write_file("$config_directory/config", \%gconfig);
|
||||
&unlock_file("$config_directory/config");
|
||||
|
||||
@@ -62,6 +62,16 @@ print &ui_table_row($text{'advanced_pass'},
|
||||
print &ui_table_row($text{'advanced_umask'},
|
||||
&ui_opt_textbox("umask", $gconfig{'umask'}, 5, $text{'default'}));
|
||||
|
||||
# Nice level for cron jobs
|
||||
if (&foreign_check("proc")) {
|
||||
&foreign_require("proc", "proc-lib.pl");
|
||||
print &ui_table_row($text{'advanced_nice'},
|
||||
&ui_radio("nice_def", $gconfig{'nice'} eq '' ? 1 : 0,
|
||||
[ [ 1, $text{'default'} ],
|
||||
[ 0, $text{'advanced_pri'}." ".
|
||||
&proc::nice_selector("nice", $gconfig{'nice'} || 0) ] ]));
|
||||
}
|
||||
|
||||
print &ui_table_end();
|
||||
print &ui_form_end([ [ "save", $text{'save'} ] ]);
|
||||
|
||||
|
||||
@@ -745,6 +745,8 @@ advanced_showstderr=Show Perl errors in browser?
|
||||
advanced_umask=Umask (unset permission bits) for created files
|
||||
advanced_eumask=Umask must be a 3-digit octal number
|
||||
advanced_etempdelete=Missing or invalid maximum age of temporary files
|
||||
advanced_nice=CPU priority for scheduled jobs
|
||||
advanced_pri=Priority level
|
||||
|
||||
syslog_errorlog=Webmin error log
|
||||
|
||||
|
||||
Reference in New Issue
Block a user