mirror of
https://github.com/webmin/webmin.git
synced 2026-02-03 14:13:29 +00:00
Stop / start / restart buttons
This commit is contained in:
@@ -28,8 +28,8 @@ print &ui_buttons_start();
|
||||
# Show start/stop/restart buttons
|
||||
my $pid = &is_iscsi_server_running();
|
||||
if ($pid) {
|
||||
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
|
||||
$text{'index_stopdesc'});
|
||||
print &ui_buttons_row("restart.cgi", $text{'index_restart'},
|
||||
$text{'index_restartdesc'});
|
||||
print &ui_buttons_row("stop.cgi", $text{'index_stop'},
|
||||
$text{'index_stopdesc'});
|
||||
}
|
||||
|
||||
@@ -202,6 +202,31 @@ sub is_iscsi_server_running
|
||||
return &check_pid_file($config{'pid_file'});
|
||||
}
|
||||
|
||||
# start_iscsi_server()
|
||||
# Launch the iscsi server process, and return undef if successful
|
||||
sub start_iscsi_server
|
||||
{
|
||||
my $out = &backquote_logged("$config{'iscsi_server'} -f $config{'targets_file'} 2>&1 </dev/null");
|
||||
return $? ? $out : undef;
|
||||
}
|
||||
|
||||
# stop_iscsi_server()
|
||||
# Kill the running iscsi server process
|
||||
sub stop_iscsi_server
|
||||
{
|
||||
my $pid = &is_iscsi_server_running();
|
||||
return "Not running" if (!$pid);
|
||||
return kill('TERM', $pid) ? undef : "Kill failed : $!";
|
||||
}
|
||||
|
||||
# restart_iscsi_server()
|
||||
# Kill and re-start the iscsi server process
|
||||
sub restart_iscsi_server
|
||||
{
|
||||
&stop_iscsi_server();
|
||||
return &start_iscsi_server();
|
||||
}
|
||||
|
||||
# find_free_num(&config, type)
|
||||
# Returns the max used device number of some type, plus 1
|
||||
sub find_free_num
|
||||
|
||||
@@ -7,8 +7,8 @@ index_stop=Stop iSCSI Server
|
||||
index_stopdesc=Click this button to stop the running iSCSI server. All shared devices will no longer be accessible to clients.
|
||||
index_start=Start iSCSI Server
|
||||
index_startdesc=Click this button to start the iSCSI server, so that shared devices are accessible to clients.
|
||||
index_restart=Click this button to apply the current configuration by restarting the iSCSI server.
|
||||
index_restart=Restart iSCSI Server
|
||||
index_restartdesc=Click this button to apply the current configuration by restarting the iSCSI server.
|
||||
index_atboot=Start at boot?
|
||||
index_atbootdesc=Change this option to control whether the iSCSI server is started at boot time or not. If it is not currently started at boot and Yes is chosen, a new init script will be created.
|
||||
index_return=module index
|
||||
@@ -78,3 +78,7 @@ targets_delete=Delete Selected Targets
|
||||
desc_extent=Device to share $1
|
||||
desc_device=Device combination $1
|
||||
desc_target=Sharing target $1
|
||||
|
||||
start_err=Failed to start iSCSI server
|
||||
stop_err=Failed to stop iSCSI server
|
||||
restart_err=Failed to restart iSCSI server
|
||||
|
||||
12
iscsi-server/restart.cgi
Normal file
12
iscsi-server/restart.cgi
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Stop and then re-start the iSCSI server process
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './iscsi-server-lib.pl';
|
||||
our (%text);
|
||||
&error_setup($text{'restart_err'});
|
||||
my $err = &restart_iscsi_server();
|
||||
&error("<tt>".&html_escape($err)."</tt>") if ($err);
|
||||
&webmin_log("restart");
|
||||
&redirect("");
|
||||
12
iscsi-server/start.cgi
Normal file
12
iscsi-server/start.cgi
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Start the iSCSI server process
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './iscsi-server-lib.pl';
|
||||
our (%text);
|
||||
&error_setup($text{'start_err'});
|
||||
my $err = &start_iscsi_server();
|
||||
&error("<tt>".&html_escape($err)."</tt>") if ($err);
|
||||
&webmin_log("start");
|
||||
&redirect("");
|
||||
12
iscsi-server/stop.cgi
Normal file
12
iscsi-server/stop.cgi
Normal file
@@ -0,0 +1,12 @@
|
||||
#!/usr/local/bin/perl
|
||||
# Kill the running iscsi server process
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
require './iscsi-server-lib.pl';
|
||||
our (%text);
|
||||
&error_setup($text{'stop_err'});
|
||||
my $err = &stop_iscsi_server();
|
||||
&error($err) if ($err);
|
||||
&webmin_log("stop");
|
||||
&redirect("");
|
||||
Reference in New Issue
Block a user