Server IP : 195.201.23.43 / Your IP : 3.146.176.29 Web Server : Apache System : Linux webserver2.vercom.be 5.4.0-192-generic #212-Ubuntu SMP Fri Jul 5 09:47:39 UTC 2024 x86_64 User : kdecoratie ( 1041) PHP Version : 7.1.33-63+ubuntu20.04.1+deb.sury.org+1 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/status/ |
Upload File : |
#!/usr/bin/perl # save_sched.cgi # Save scheduled monitoring options require './status-lib.pl'; $access{'sched'} || &error($text{'sched_ecannot'}); &ReadParse(); &error_setup($text{'sched_err'}); # Parse and save inputs $in{'email_def'} || $in{'email'} =~ /\S/ || &error($text{'sched_eemail'}); $config{'sched_email'} = $in{'email_def'} ? '' : $in{'email'}; if ($config{'pager_cmd'}) { $config{'sched_pager'} = $in{'pager_def'} ? '' : $in{'pager'}; } if ($in{'sms_def'}) { delete($config{'sched_carrier'}); delete($config{'sched_sms'}); } else { $config{'sched_carrier'} = $in{'carrier'}; ($carrier) = grep { $_->{'id'} eq $in{'carrier'} } &list_sms_carriers(); if ($carrier->{'alpha'}) { $in{'sms'} =~ /^\S+$/ || &error($text{'sched_esmsname'}); } else { $in{'sms'} =~ /^\d+$/ || &error($text{'sched_esmsnumber'}); } $config{'sched_sms'} = $in{'sms'}; } if ($in{'smode'} == 0) { delete($config{'sched_subject'}); } elsif ($in{'smode'} == 1) { $config{'sched_subject'} = '*'; } else { $in{'subject'} =~ /\S/ || &error($text{'sched_esubject'}); $config{'sched_subject'} = $in{'subject'}; } if ($in{'from_def'}) { delete($config{'sched_from'}); } else { $in{'from'} =~ /^\S+$/ || &error($text{'sched_efrom'}); $config{'sched_from'} = $in{'from'}; } if ($in{'smtp_def'}) { if (!$in{'from_def'}) { &foreign_require("mailboxes"); $err = &mailboxes::test_mail_system(); $err && &error(&text('sched_eemailserver', $err)); } delete($config{'sched_smtp'}); } else { if (!$in{'from_def'}) { &to_ipaddress($in{'smtp'}) || &to_ip6address($in{'smtp'}) || &error($text{'sched_esmtp'}); } $config{'sched_smtp'} = $in{'smtp'}; } if ($in{'webhook_def'}) { delete($config{'sched_webhook'}); } else { $in{'webhook'} =~ /^(http|https):\/\/\S+$/ || &error($text{'sched_ewebhook'}); $config{'sched_webhook'} = $in{'webhook'}; } $config{'sched_mode'} = $in{'mode'}; $in{'int'} =~ /^\d+$/ || &error($text{'sched_eint'}); $config{'sched_int'} = $in{'int'}; $config{'sched_period'} = $in{'period'}; $in{'offset'} =~ /^\d+$/ || &error($text{'sched_eoffset'}); $config{'sched_offset'} = $in{'offset'}; $config{'sched_warn'} = $in{'warn'}; $config{'sched_single'} = $in{'single'}; @hours = split(/\0/, $in{'hours'}); @hours || &error($text{'sched_ehours'}); $config{'sched_hours'} = @hours == 24 ? '' : join(" ", @hours); @days = split(/\0/, $in{'days'}); @days || &error($text{'sched_edays'}); $config{'sched_days'} = @days == 7 ? '' : join(" ", @days); &lock_file("$module_config_directory/config"); &save_module_config(); &unlock_file("$module_config_directory/config"); # Setup or remove the cron job &setup_cron_job(); &webmin_log("sched"); &redirect("");Private