From 63e4afbce6a2a27b9d2396dc6574c8ed6c5ce9cc Mon Sep 17 00:00:00 2001 From: Jamie Cameron Date: Sat, 26 Sep 2020 19:22:07 -0700 Subject: [PATCH] Start of work on atd server support --- at/index.cgi | 24 ++++++++++++++++++++++++ at/lang/en | 4 ++++ at/linux-lib.pl | 11 +++++++++++ 3 files changed, 39 insertions(+) diff --git a/at/index.cgi b/at/index.cgi index f3060e66e..2009213ef 100755 --- a/at/index.cgi +++ b/at/index.cgi @@ -137,5 +137,29 @@ if ($access{'allow'} && $config{'allow_file'}) { print &ui_form_end([ [ "save", $text{'save'} ] ]); } +# If there is an init script that runs an atd server, show status +&foreign_require("init"); +my $init = defined(&get_init_name) ? &get_init_name() : undef; +if ($init) { + print &ui_hr(); + print &ui_buttons_start(); + + # Running now? + my $r = &init::status_action($init); + if ($r == 1) { + print &ui_buttons_row("stop.cgi", $text{'index_stop'}, + $text{'index_stopdesc'}); + } + elsif ($r == 0) { + print &ui_buttons_row("start.cgi", $text{'index_start'}, + $text{'index_startdesc'}); + } + + # Start at boot? + # XXX + + print &ui_buttons_end(); + } + &ui_print_footer("/", $text{'index'}); diff --git a/at/lang/en b/at/lang/en index 3124a2bf8..5c6d5dc84 100644 --- a/at/lang/en +++ b/at/lang/en @@ -20,6 +20,10 @@ index_amode2=All except listed users .. index_delete=Cancel Selected Commands index_noat=The $1 command was not found on your system - maybe it is not installed, or not available for your operating system. index_nostyle=Webmin does not know how to manage schedule commands on this operating system. +index_stop=Stop Scheduled Commands Server +index_stopdesc=Shut down the atd background server process that runs scheduled commands. This will prevent commands from executing at their specified times. +index_start=Start Scheduled Commands Server +index_startdesc=Start up the atd background server process that runs scheduled commands. This is required for commands to execute at their specified times. edit_title=Scheduled Command edit_cmd=Full script to execute diff --git a/at/linux-lib.pl b/at/linux-lib.pl index 9b3c8f6b3..0010658f1 100755 --- a/at/linux-lib.pl +++ b/at/linux-lib.pl @@ -59,3 +59,14 @@ sub delete_atjob &system_logged("atrm ".quotemeta($_[0])." >/dev/null 2>&1"); } +# get_init_name() +# Returns the name of the bootup action for atd, if there is one +sub get_init_name +{ +&foreign_require("init"); +if (&init::action_status("atd") != 0) { + return "atd"; + } +return undef; +} +