Finished off support for stopping and starting atd

This commit is contained in:
Jamie Cameron
2020-10-01 13:25:03 -07:00
parent a8afe6394f
commit 98efcf494b
5 changed files with 43 additions and 5 deletions

View File

@ -156,7 +156,12 @@ if ($init) {
}
# Start at boot?
# XXX
my $atboot = &init::action_status($init);
print &ui_buttons_row("bootup.cgi", $text{'index_boot'},
$text{'index_bootdesc'}, undef,
&ui_radio("boot", $atboot == 2 ? 1 : 0,
[ [ 1, $text{'yes'} ],
[ 0, $text{'no'} ] ]));
print &ui_buttons_end();
}

View File

@ -24,6 +24,8 @@ index_stop=Stop Scheduled Commands Server
index_stopdesc=Shut down the <tt>atd</tt> 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 <tt>atd</tt> background server process that runs scheduled commands. This is required for commands to execute at their specified times.
index_boot=Start Server At Boot?
index_bootdesc=Change this setting to enable or disable starting the scheduled commands server at system boot time.
edit_title=Scheduled Command
edit_cmd=Full script to execute
@ -70,4 +72,12 @@ log_create_job=Created scheduled command for $1
log_delete_job=Cancelled scheduled command for $1
log_exec_job=Executed scheduled command for $1
log_delete_jobs=Cancelled $1 scheduled commands
log_stop=Stopped scheduled commands server
log_start=Started scheduled commands server
log_bootup=Enabled scheduled commands server at boot
log_bootdown=Disabled scheduled commands server at boot
stop_err=Failed to stop server
start_err=Failed to start server
__norefs=1

View File

@ -18,11 +18,8 @@ if ($type eq "job") {
elsif ($type eq "jobs") {
return &text('log_'.$action.'_jobs', $object);
}
elsif ($action eq 'allow') {
return $text{'log_allow'};
}
else {
return undef;
return $text{'log_'.$action};
}
}

13
at/start.cgi Normal file
View File

@ -0,0 +1,13 @@
#!/usr/local/bin/perl
# Start the atd server
require './at-lib.pl';
&error_setup($text{'start_err'});
&foreign_require("init");
my $init = &get_init_name();
my ($ok, $err) = &init::start_action($init);
&error($err) if (!$ok);
&webmin_log("start");
&redirect("");

13
at/stop.cgi Normal file
View File

@ -0,0 +1,13 @@
#!/usr/local/bin/perl
# Stop the atd server
require './at-lib.pl';
&error_setup($text{'stop_err'});
&foreign_require("init");
my $init = &get_init_name();
my ($ok, $err) = &init::stop_action($init);
&error($err) if (!$ok);
&webmin_log("stop");
&redirect("");