| Server IP : 104.21.25.180 / Your IP : 104.23.197.123 Web Server : Apache/2.4.37 System : Linux almalinux.duckdns.org 4.18.0-553.111.1.el8_10.x86_64 #1 SMP Sun Mar 8 20:06:07 EDT 2026 x86_64 User : ricodeal ( 1046) PHP Version : 7.4.33 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/libexec/webmin/virtual-server/ |
Upload File : |
#!/usr/bin/perl
# Set up regular quota monitoring
require './virtual-server-lib.pl';
&ReadParse();
&licence_status();
&error_setup($text{'newquotas_err'});
&can_edit_templates() || &error($text{'newquotas_ecannot'});
# Validate inputs
$oldjob = $job = &find_cron_script($quotas_cron_cmd);
$job ||= { 'user' => 'root',
'active' => 1,
'command' => $quotas_cron_cmd };
if ($in{'sched'}) {
if ($in{'email_def'} == 0) {
$in{'email'} =~ /^\S+\@\S+$/ ||
&error($text{'newquotas_eemail'});
}
if (!$in{'warn_def'}) {
$in{'warn'} || &error($text{'newquotas_ewarn2'});
$in{'warn'} =~ s/,/ /g; # Allow commas
foreach $w (split(/\s+/, $in{'warn'})) {
$w =~ /^\d+$/ && $w > 0 && $w < 100 ||
&error($text{'newquotas_ewarn3'});
}
}
&virtualmin_ui_parse_cron_time("sched", $job, \%in);
}
$config{'quota_email'} = $in{'email_def'} == 1 ? undef :
$in{'email_def'} == 2 ? '*' : $in{'email'};
$config{'quota_mailbox'} = $in{'mailbox'};
$config{'quota_mailbox_send'} = $in{'mailbox_send'};
$config{'quota_users'} = $in{'users'};
$config{'quota_warn'} = $in{'warn_def'} ? undef : $in{'warn'};
if ($in{'interval_def'}) {
delete($config{'quota_interval'});
}
else {
$in{'interval'} =~ /^[1-9]\d*$/ || &error($text{'newquotas_einterval'});
$config{'quota_interval'} = $in{'interval'};
}
$in{'msg'} =~ s/\r//g;
$in{'msg'} =~ /\S/ || &error($text{'newquotas_emsg'});
# Setup the cron job
if ($oldjob) {
&delete_cron_script($oldjob);
}
if ($in{'sched'}) {
&setup_cron_script($job);
}
# Save configuration
&lock_file($module_config_file);
$config{'last_check'} = time()+1; # no need for check.cgi to be run
&save_module_config();
&unlock_file($module_config_file);
&lock_file($user_quota_msg_file);
&save_quotas_message($in{'msg'});
&unlock_file($user_quota_msg_file);
&run_post_actions_silently();
&webmin_log("quotas");
&redirect("");