diff --git a/pandora_server/util/pandora_manage.pl b/pandora_server/util/pandora_manage.pl index 3b72f91063..a3ffd61ecb 100755 --- a/pandora_server/util/pandora_manage.pl +++ b/pandora_server/util/pandora_manage.pl @@ -5895,9 +5895,16 @@ sub cli_stop_downtime () { exist_check($downtime_id,'planned downtime',$downtime_id); my $current_time = time; - my $downtime_date_to = get_db_value ($dbh, 'SELECT date_to FROM tplanned_downtime WHERE id=?', $downtime_id); - if($current_time >= $downtime_date_to) { + my $data = get_db_single_row ($dbh, 'SELECT date_to, type_execution, executed FROM tplanned_downtime WHERE id=?', $downtime_id); + + if( $data->{'type_execution'} eq 'periodically' && $data->{'executed'} == 1){ + print_log "[ERROR] Planned_downtime '$downtime_name' cannot be stopped.\n"; + print_log "[INFO] Periodical and running planned downtime cannot be stopped.\n\n"; + exit; + } + + if($current_time >= $data->{'date_to'}) { print_log "[INFO] Planned_downtime '$downtime_name' is already stopped\n\n"; exit; }