mirror of
https://github.com/webmin/webmin.git
synced 2026-03-20 16:50:24 +00:00
Allow custom commands to apply config to be set
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
config_file=/etc/tgt/targets.conf
|
||||
tgtd=tgtd
|
||||
tgtadm=tgtadm
|
||||
tgtadmin=tgt-admin
|
||||
init_name=tgtd
|
||||
restart_cmd=/etc/init.d/tgtd reload
|
||||
|
||||
@@ -4,3 +4,6 @@ tgtd=Full path to tgtd command,0
|
||||
tgtadm=Full path to tgtadm command,0
|
||||
tgtadmin=Full path to tgt-admin command,0
|
||||
init_name=Bootup script name,0
|
||||
start_cmd=Commamd to start iSCSI TGTd,3,Start init script
|
||||
stop_cmd=Commamd to stop iSCSI TGTd,3,Stop init script
|
||||
restart_cmd=Commamd to restart iSCSI TGTd,3,Restart init script
|
||||
|
||||
@@ -334,33 +334,51 @@ return 0 if (&init::action_status($config{'init_name'}));
|
||||
# Run the init script to start the server
|
||||
sub start_iscsi_tgtd
|
||||
{
|
||||
&setup_tgtd_init();
|
||||
&foreign_require("init");
|
||||
my ($ok, $out) = &init::start_action($config{'init_name'});
|
||||
return $ok ? undef : $out;
|
||||
if ($config{'start_cmd'}) {
|
||||
my $out = &backquote_command("$config{'start_cmd'} 2>&1 </dev/null");
|
||||
return $? ? $out : undef;
|
||||
}
|
||||
else {
|
||||
&setup_tgtd_init();
|
||||
&foreign_require("init");
|
||||
my ($ok, $out) = &init::start_action($config{'init_name'});
|
||||
return $ok ? undef : $out;
|
||||
}
|
||||
}
|
||||
|
||||
# stop_iscsi_tgtd()
|
||||
# Run the init script to stop the server
|
||||
sub stop_iscsi_tgtd
|
||||
{
|
||||
&setup_tgtd_init();
|
||||
&foreign_require("init");
|
||||
my ($ok, $out) = &init::stop_action($config{'init_name'});
|
||||
return $ok ? undef : $out;
|
||||
if ($config{'stop_cmd'}) {
|
||||
my $out = &backquote_command("$config{'stop_cmd'} 2>&1 </dev/null");
|
||||
return $? ? $out : undef;
|
||||
}
|
||||
else {
|
||||
&setup_tgtd_init();
|
||||
&foreign_require("init");
|
||||
my ($ok, $out) = &init::stop_action($config{'init_name'});
|
||||
return $ok ? undef : $out;
|
||||
}
|
||||
}
|
||||
|
||||
# restart_iscsi_tgtd()
|
||||
# Sends a HUP signal to re-read the configuration
|
||||
sub restart_iscsi_tgtd
|
||||
{
|
||||
&stop_iscsi_tgtd();
|
||||
# Wait for process to exit
|
||||
for(my $i=0; $i<20; $i++) {
|
||||
last if (!&is_tgtd_running());
|
||||
sleep(1);
|
||||
if ($config{'restart_cmd'}) {
|
||||
my $out = &backquote_command("$config{'restart_cmd'} 2>&1 </dev/null");
|
||||
return $? ? $out : undef;
|
||||
}
|
||||
else {
|
||||
&stop_iscsi_tgtd();
|
||||
# Wait for process to exit
|
||||
for(my $i=0; $i<20; $i++) {
|
||||
last if (!&is_tgtd_running());
|
||||
sleep(1);
|
||||
}
|
||||
return &start_iscsi_tgtd();
|
||||
}
|
||||
return &start_iscsi_tgtd();
|
||||
}
|
||||
|
||||
# get_device_size(device, "part"|"raid"|"lvm"|"other")
|
||||
|
||||
Reference in New Issue
Block a user