From b489d95dc8911ea75956d5abe918329761b5127b Mon Sep 17 00:00:00 2001 From: psc Date: Tue, 23 Feb 2010 09:45:02 +0000 Subject: [PATCH] Commit LHM-local patch Use goto-action to trigger local si-client events git-svn-id: https://oss.gonicus.de/repositories/gosa/branches/2.6-lhm@15669 594d385d-05f5-0310-b6e9-bd551577e9d8 --- trunk/gosa-si/client/events/gosaTriggered.pm | 67 ++++++++++---------- 1 file changed, 34 insertions(+), 33 deletions(-) diff --git a/trunk/gosa-si/client/events/gosaTriggered.pm b/trunk/gosa-si/client/events/gosaTriggered.pm index dca6f6308..ed19d3120 100644 --- a/trunk/gosa-si/client/events/gosaTriggered.pm +++ b/trunk/gosa-si/client/events/gosaTriggered.pm @@ -281,25 +281,18 @@ sub trigger_action_reboot { my ($msg, $msg_hash) = @_; my $timeout; - if((not exists $msg_hash->{timeout} ) || (1 != @{$msg_hash->{timeout}} ) ) { - $timeout = 0; - } - else { - $timeout = @{$msg_hash->{timeout}}[0]; - } - # check logged in user my @user_list = &get_logged_in_users; if( @user_list >= 1 ) { system( "/usr/bin/goto-notify reboot" ); - open(FILE, "> /etc/gosa-si/event"); - print FILE "reboot\n"; - close(FILE); - } - else { - system( "/sbin/shutdown -r +$timeout &" ); } + open(FILE, "> /etc/gosa-si/event"); + print FILE "reboot\n"; + close(FILE); + + system( "/usr/sbin/goto-action &" ); + return; } @@ -339,25 +332,18 @@ sub trigger_action_halt { my ($msg, $msg_hash) = @_; my $timeout; - if((not exists $msg_hash->{timeout} ) || (1 != @{$msg_hash->{timeout}} ) ) { - $timeout = 0; - } - else { - $timeout = @{$msg_hash->{timeout}}[0]; - } - # check logged in user 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 "halt\n"; - close(FILE); - } - else { - system( "/sbin/shutdown -h +$timeout &" ); } + open(FILE, "> /etc/gosa-si/event"); + print FILE "halt\n"; + close(FILE); + + system( "/usr/sbin/goto-action &" ); + return; } @@ -404,9 +390,8 @@ sub trigger_action_reinstall { print FILE "install\n"; close(FILE); } - else { - system( "/sbin/shutdown -r now &" ); - } + + system( "/usr/sbin/goto-action &" ); return; } @@ -446,8 +431,16 @@ sub trigger_action_reinstall { sub trigger_action_update { my ($msg, $msg_hash) = @_; - # Execute update - system( "DEBIAN_FRONTEND=noninteractive /usr/sbin/fai-softupdate &" ); + # check logged in user + my @user_list = &get_logged_in_users; + if( @user_list >= 1 ) { + system( "/usr/bin/goto-notify softupdate" ); + open(FILE, "> /etc/gosa-si/event"); + print FILE "softupdate\n"; + close(FILE); + } + + system( "/usr/sbin/goto-action &" ); return; } @@ -487,8 +480,16 @@ sub trigger_action_update { sub trigger_action_instant_update { my ($msg, $msg_hash) = @_; - # Execute update - system( "DEBIAN_FRONTEND=noninteractive /usr/sbin/fai-softupdate &" ); + # check logged in user + my @user_list = &get_logged_in_users; + if( @user_list >= 1 ) { + system( "/usr/bin/goto-notify softupdate" ); + open(FILE, "> /etc/gosa-si/event"); + print FILE "softupdate\n"; + close(FILE); + } + + system( "/usr/sbin/goto-action &" ); return; } -- 2.30.2