parent
8e4cc95c1b
commit
c9467baee7
1 changed files with 0 additions and 56 deletions
@ -1,56 +0,0 @@ |
||||
#!/usr/bin/perl |
||||
|
||||
#---------------------------------------------------------------------- |
||||
# $Id: tug-restart,v 1.23 2003/06/25 14:04:54 msoulier Exp $ |
||||
#---------------------------------------------------------------------- |
||||
# copyright (C) 1999-2003 Mitel Networks Corporation |
||||
#---------------------------------------------------------------------- |
||||
|
||||
package esmith; |
||||
|
||||
use strict; |
||||
use warnings; |
||||
use esmith::ConfigDB; |
||||
use esmith::util; |
||||
|
||||
use constant TRUE => 1; |
||||
use constant FALSE => 0; |
||||
|
||||
my $action; |
||||
|
||||
my $db = esmith::ConfigDB->open_ro |
||||
or die "Failed to open configuration database.\n"; |
||||
|
||||
my $status = $db->get_prop('mailman', 'status') || 'disabled'; |
||||
|
||||
if ($status eq 'enabled') |
||||
{ |
||||
$action = 'start'; |
||||
$action = 'restart' if is_running(); |
||||
} |
||||
else |
||||
{ |
||||
$action = ''; |
||||
$action = 'stop' if is_running(); |
||||
} |
||||
|
||||
if ($action && $action ne '') |
||||
{ |
||||
esmith::util::serviceControl( |
||||
NAME => 'mailman', |
||||
ACTION => $action, |
||||
BACKGROUND => 'true' |
||||
) or die "Failed to $action mailman\n"; |
||||
} |
||||
|
||||
exit 0; |
||||
|
||||
sub is_running |
||||
{ |
||||
chomp( my $output = `/usr/bin/sv s /service/mailman` ); |
||||
if ($output =~ /run:\s\/service\/mailman(\/)?:\s\(pid\s\d+\)/) |
||||
{ |
||||
return TRUE; |
||||
} |
||||
return FALSE; |
||||
} |
Loading…
Reference in new issue