From: cajus Date: Wed, 26 Mar 2008 18:10:05 +0000 (+0000) Subject: Updated trigger event X-Git-Url: https://git.tokkee.org/?a=commitdiff_plain;h=1bf6d6303fb62f5b51b9ebff12524f7631a02bc7;p=gosa.git Updated trigger event git-svn-id: https://oss.gonicus.de/repositories/gosa/trunk@10004 594d385d-05f5-0310-b6e9-bd551577e9d8 --- diff --git a/gosa-si/client/events/gosaTriggered.pm b/gosa-si/client/events/gosaTriggered.pm index cf364b4dd..9e57a5460 100644 --- a/gosa-si/client/events/gosaTriggered.pm +++ b/gosa-si/client/events/gosaTriggered.pm @@ -81,7 +81,7 @@ sub trigger_action_reboot { my $timeout; if((not exists $msg_hash->{timeout} ) || (1 != @{$msg_hash->{timeout}} ) ) { - $timeout = -1; + $timeout = 0; } else { $timeout = @{$msg_hash->{timeout}}[0]; @@ -90,36 +90,16 @@ sub trigger_action_reboot { # check logged in user my @user_list = &get_logged_in_users; if( @user_list >= 1 ) { - # TODO do something - } - else { - $timeout = 0; - } - - # execute function - if( $timeout == 0 ) { - print STDERR ("shutdown -r +$timeout\n"); - } - elsif( $timeout > 0 ) { - print STDERR ("shutdown -r +$timeout\n"); - } - elsif( $timeout < 0 ) { - print STDERR "The administrator has sent a signal to reboot this workstation. It will reboot after you've logged out.\n"; + system( "/usr/bin/goto-notify reboot" ); open(FILE, "> /etc/gosa-si/event"); - print FILE "trigger_action_reboot\n"; + print FILE "reboot\n"; close(FILE); } else { - # TODO do something, error handling, logging + system( "/sbin/shutdown -r +$timeout &" ); } return; - - - - - print STDERR "jetzt würde ich trigger_action_reboot ausführen\n"; - return; } @@ -128,87 +108,41 @@ sub trigger_action_halt { my $timeout; if((not exists $msg_hash->{timeout} ) || (1 != @{$msg_hash->{timeout}} ) ) { - $timeout = -1; + $timeout = 0; } else { $timeout = @{$msg_hash->{timeout}}[0]; } # check logged in user - my $logged_in_user = 1; - if( $logged_in_user ) { - # TODO do something - } - else { - $timeout = 0; - } - - # execute function - if( $timeout == 0 ) { - print STDERR ("shutdown -h +$timeout\n"); - } - elsif( $timeout > 0 ) { - print STDERR ("shutdown -h +$timeout\n"); - } - elsif( $timeout < 0 ) { - print STDERR "The administrator has sent a signal to shutdown this workstation. It will shutdown after you've logged out.\n"; + my @user_list = &get_logged_in_users; + if( @user_list >= 1 ) { + system( "/usr/bin/goto-notify halt" ); open(FILE, "> /etc/gosa-si/event"); - print FILE "trigger_action_halt\n"; + print FILE "halt\n"; close(FILE); } else { - # TODO do something, error handling, logging + system( "/sbin/shutdown -h +$timeout &" ); } return; } -# TODO -sub trigger_action_memcheck { - my ($msg, $msg_hash) = @_ ; - print STDERR "\n\njetzt würde ich trigger_action_memcheck ausführen\n\n"; - return; -} - - sub trigger_action_reinstall { my ($msg, $msg_hash) = @_; - my $timeout; - - # check timeout - if((not exists $msg_hash->{timeout} ) || (1 != @{$msg_hash->{timeout}} ) ) { - $timeout = -1; - } - else { - $timeout = @{$msg_hash->{timeout}}[0]; - } # check logged in user - my $logged_in_user = 1; - if( $logged_in_user ) { - # TODO do something - } - else { - $timeout = 0; - } - - # execute function - if( $timeout == 0 ) { - print STDERR ("shutdown -r +$timeout\n"); - } - elsif( $timeout > 0 ) { - print STDERR ("shutdown -r +$timeout\n"); - - } - elsif( $timeout < 0 ) { - print STDERR "The administrator has sent a signal to reinstall this workstation. It will reinstall after you've logged out.\n"; + my @user_list = &get_logged_in_users; + if( @user_list >= 1 ) { + system( "/usr/bin/goto-notify install" ); open(FILE, "> /etc/gosa-si/event"); - print FILE "trigger_action_reinstall\n"; + print FILE "install\n"; close(FILE); } else { - # TODO do something, error handling, logging + system( "/sbin/shutdown -r now &" ); } return; @@ -236,18 +170,4 @@ sub trigger_action_instant_update { } -# TODO -sub trigger_action_sysinfo { - my ($msg, $msg_hash) = @_; - print STDERR "jetzt würde ich trigger_action_sysinfo ausführen\n"; - return; -} - -# TODO -sub trigger_action_rescan{ - my ($msg, $msg_hash) = @_; - print STDERR "jetzt würde ich trigger_action_rescan ausführen\n"; - return; -} - 1;