mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
API for listing action names generically
This commit is contained in:
@@ -1387,6 +1387,34 @@ else {
|
||||
}
|
||||
}
|
||||
|
||||
=head2 list_action_names()
|
||||
|
||||
Returns a list of just action names
|
||||
|
||||
=cut
|
||||
sub list_action_names
|
||||
{
|
||||
if ($init_mode eq "upstart") {
|
||||
return map { $_->{'name'} } &list_upstart_services();
|
||||
}
|
||||
elsif ($init_mode eq "systemd") {
|
||||
return map { $_->{'name'} } &list_systemd_services();
|
||||
}
|
||||
elsif ($init_mode eq "init") {
|
||||
return map { my @w = split(/\s+/, $_); $w[0] } &list_actions();
|
||||
}
|
||||
elsif ($init_mode eq "win32") {
|
||||
return map { $_->{'name'} } &list_win32_services();
|
||||
}
|
||||
elsif ($init_mode eq "rc") {
|
||||
return map { $_->{'name'} } &list_rc_scripts();
|
||||
}
|
||||
elsif ($init_mode eq "launchd") {
|
||||
return map { $_->{'name'} } &list_launchd_agents();
|
||||
}
|
||||
return ( );
|
||||
}
|
||||
|
||||
=head2 get_action_mode(name)
|
||||
|
||||
Returns the init mode used by some action. May be different from the global
|
||||
|
||||
25
status/init-monitor.pl
Normal file
25
status/init-monitor.pl
Normal file
@@ -0,0 +1,25 @@
|
||||
# init-monitor.pl
|
||||
# Check if a bootup service is running
|
||||
|
||||
sub get_init_status
|
||||
{
|
||||
return { 'up' => -1 } if (!&foreign_installed("init"));
|
||||
&foreign_require("init");
|
||||
local $st = &init::status_action($_[0]->{'action'});
|
||||
return { 'up' => $st };
|
||||
}
|
||||
|
||||
sub show_init_dialog
|
||||
{
|
||||
&foreign_require("init");
|
||||
local @actions = &init::list_action_names();
|
||||
print &ui_table_row($text{'init_action'},
|
||||
&ui_select("action", $_[0]->{'action'}, \@actions));
|
||||
}
|
||||
|
||||
sub parse_init_dialog
|
||||
{
|
||||
&depends_check($_[0], "init");
|
||||
$_[0]->{'action'} = $in{'action'};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user