Changeset 238
- Timestamp:
- 04/16/07 12:34:00 (2 years ago)
- Files:
-
- trunk/webmin/lsc/debian/changelog (modified) (1 diff)
- trunk/webmin/lsc/images/icon-menu.gif (modified) (previous)
- trunk/webmin/lsc/include/command_launcher.inc.php (modified) (3 diffs)
- trunk/webmin/lsc/include/commands.inc.php (modified) (2 diffs)
- trunk/webmin/lsc/include/commands_on_host.inc.php (modified) (3 diffs)
- trunk/webmin/lsc/include/scheduler.inc.php (modified) (3 diffs)
- trunk/webmin/lsc/module.info (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/webmin/lsc/debian/changelog
r229 r238 1 webmin-lsc (1.0. 4) stable; urgency=low1 webmin-lsc (1.0.5) stable; urgency=low 2 2 3 3 * See SVN history trunk/webmin/lsc/include/command_launcher.inc.php
r229 r238 563 563 return 0; 564 564 } 565 566 /* Check if next_attempt is not properly initialized (pre 1.0.3 transition) */ 567 if ($this->command_on_host->next_launch_date == "0000-00-00 00:00:00" && 568 $this->command_on_host->start_date != "0000-00-00 00:00:00" ) { 569 570 lsc_command_on_host_set_next_launch_date($this->id_command_on_host, $this->command_on_host->start_date); 571 return(0); 572 } 573 565 574 $this->session = new LSC_Session($mac, $this->command->username); 566 575 … … 577 586 ); 578 587 return 0; 579 } else {580 lsc_command_on_host_set_current_state(581 $this->id_command_on_host,582 "not_reachable"583 );584 lsc_command_history_append(585 $this->id_command_on_host,586 date("Y-m-d H:i:s"),587 "not_reachable",588 $this->session->ssh_stderr,589 $this->session->msgerror590 );591 return -1;592 588 } 593 589 } else { 594 590 /* 595 * Wake on lan and retry591 * Ping error: Wake on lan and retry 596 592 */ 597 593 if ($this->command->wake_on_lan_enable) { … … 611 607 } 612 608 } 613 /* 614 * Connection error ... 615 */ 616 617 lsc_command_on_host_set_current_state( 618 $this->id_command_on_host, 619 "not_reachable" 620 ); 621 lsc_command_history_append( 622 $this->id_command_on_host, 623 date("Y-m-d H:i:s"), 624 "not_reachable", 625 "", 626 $this->session->msgerror 627 ); 628 629 lsc_command_on_host_set_remains_connection_attempt( 630 $this->id_command_on_host, 631 --$remains_connection_attempt 632 ); 633 634 lsc_command_on_host_set_next_attempt_date_time( 635 $this->id_command_on_host, 636 time() + ($this->command->next_connection_delay * 60) 637 ); 638 639 if ($remains_connection_attempt <= 0) return -1; 640 641 sleep($this->command->next_connection_delay * 60); 642 } 609 } 610 611 /* 612 * Connection error ... 613 */ 614 615 lsc_command_on_host_set_current_state( 616 $this->id_command_on_host, 617 "not_reachable" 618 ); 619 lsc_command_history_append( 620 $this->id_command_on_host, 621 date("Y-m-d H:i:s"), 622 "not_reachable", 623 $this->session->ssh_stderr, 624 $this->session->msgerror 625 ); 626 627 /* decrement connection attempts */ 628 lsc_command_on_host_set_remains_connection_attempt( 629 $this->id_command_on_host, 630 --$remains_connection_attempt 631 ); 632 633 /* re-schedule */ 634 if ($this->command_on_host->next_launch_date == "0000-00-00 00:00:00") { 635 lsc_command_on_host_set_next_launch_date($this->id_command_on_host, date("Y-m-d H:i:s")); 636 } 637 638 lsc_command_on_host_adjust_next_launch_date( 639 $this->id_command_on_host, 640 "+ interval ".$this->command->next_connection_delay." minute" 641 ); 642 643 return -1; 644 643 645 } 644 646 return -1; trunk/webmin/lsc/include/commands.inc.php
r229 r238 386 386 $new_command_on_host->start_date = $this->start_date; 387 387 $new_command_on_host->end_date = $this->end_date; 388 $new_command_on_host->next_launch_date = $this->start_date; 388 389 389 390 // Initialise field … … 394 395 $new_command_on_host->current_pid = -1; 395 396 396 $new_command_on_host->next_launch_date = "0000-00-00 00:00:00";397 397 398 398 $new_command_on_host->number_attempt_connection_remains = $this->max_connection_attempt; trunk/webmin/lsc/include/commands_on_host.inc.php
r229 r238 378 378 $this->executed = $database->f("executed"); 379 379 $this->deleted = $database->f("deleted"); 380 381 380 $this->next_launch_date = $database->f("next_launch_date"); 381 382 382 } else if ($database->num_rows() == 0) { 383 383 return -1; … … 659 659 } 660 660 661 /** 662 * Set next launch date 663 * 664 * @param $id_command_on_host 665 * @param new next attempt date time value 666 * 667 */ 668 function lsc_command_on_host_set_next_launch_date($id_command_on_host, $new_date_time) 669 { 670 global $database, $DEBUG; 671 672 if (!isset($database)) { 673 $database = new LSC_DB(); 674 if ($DEBUG >= 1) $database->Debug = true; 675 } 676 677 $query = sprintf( 678 " 679 UPDATE 680 %s 681 SET 682 next_launch_date = '%s' 683 WHERE 684 id_command_on_host = \"%s\" 685 ", 686 COMMANDS_ON_HOST_TABLE, 687 $new_date_time, 688 $id_command_on_host 689 ); 690 691 $database->query($query); 692 } 693 694 /** 695 * Adjust next launch date 696 * 697 * @param $id_command_on_host 698 * @param new next attempt date time value 699 * 700 */ 701 function lsc_command_on_host_adjust_next_launch_date($id_command_on_host, $new_date_time) 702 { 703 global $database, $DEBUG; 704 705 if (!isset($database)) { 706 $database = new LSC_DB(); 707 if ($DEBUG >= 1) $database->Debug = true; 708 } 709 710 $query = sprintf( 711 " 712 UPDATE 713 %s 714 SET 715 next_launch_date = next_launch_date %s 716 WHERE 717 id_command_on_host = \"%s\" 718 ", 719 COMMANDS_ON_HOST_TABLE, 720 $new_date_time, 721 $id_command_on_host 722 ); 723 724 $database->query($query); 725 } 726 661 727 function lsc_command_on_host_set_current_state($id_command_on_host, $new_state) 662 728 { … … 686 752 $database->query($query); 687 753 } 754 688 755 689 756 /** trunk/webmin/lsc/include/scheduler.inc.php
r229 r238 314 314 $query = sprintf(" 315 315 SELECT 316 A.id_command_on_host, A. start_date316 A.id_command_on_host, A.next_launch_date 317 317 FROM 318 318 %s A, … … 332 332 NOT (A.current_state = \"inventory_failed\") and 333 333 (A.number_attempt_connection_remains > 0) and 334 (A.current_pid = \"-1\") 334 (A.current_pid = \"-1\") and 335 (A.next_launch_date <= CURRENT_TIMESTAMP ) 335 336 ORDER BY 336 337 B.date_created ASC … … 348 349 // Iterate all command to dispatch 349 350 while ( $database->next_record() ) { 350 /*351 * Test if start_date < now < end_date352 */353 if ($database->f("start_date") != "0000-00-00 00:00:00") {354 if (strtotime($database->f("start_date"))>time()) {355 debug(1, "Run start_date > now for ".$database->f("id_command_on_host"));356 continue;357 }358 }359 351 360 352 $start_command = "cd ".dirname(__FILE__)."/../;./phprun.sh \"./start_command_on_host.php -id_command_on_host ".$database->f("id_command_on_host")."\" > /dev/null & echo \$!"; trunk/webmin/lsc/module.info
r229 r238 3 3 desc_fr=LRS : Prise de Contrôle à Distance Sécurisé 4 4 depends=1.030 lbs_common 5 version=1.0. 45 version=1.0.5
