ServerUtil/Solaris.pm untested

filter: Statementstmt 0.0% 0 / 19 Branchbran 0.0% 0 / 4 Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 0.0% 0 / 6 Podpod 0.0% 0 / 5 totaltotal 0.0% 0 / 37 CC 3 SCAR 13.9
CC
3
Cov
0%
startServer
6.0
stopServer
6.0
new
2.0
CRAP 4.0
1 use strict;
2 package Xpriori::XMS::ServerUtil::Solaris;
3 #---------------------------------------------------------------------
4 # new : constructor
5 #---------------------------------------------------------------------
6 sub new($)
7 {
8 return bless {}, shift(@_);
9 }
10 #---------------------------------------------------------------------
11 # startServer
12 #---------------------------------------------------------------------
13 sub startServer()
14 {
15 my (oSelf) = @_;
16 my $iSts = system('/usr/openwin/bin/xterm -e sudo /etc/init.d/neocore start');
17 return ($iSts)? 0 : 1;
18 }
19 #---------------------------------------------------------------------
20 # stopServer
21 #---------------------------------------------------------------------
22 sub stopServer()
23 {
24 my (oSelf) = @_;
25 my $iSts = system('/usr/openwin/bin/xterm -e sudo /etc/init.d/neocore stop');
26 return ($iSts)? 0 : 1;
27 }
28 #---------------------------------------------------------------------
29 # createDb
30 #---------------------------------------------------------------------
31 sub createDb($$$)
32 {
33 my($oSelf, $sNeoHome, $sPasswd);
34 return system('/usr/openwin/bin/xterm -e ' .
35 "${sNeoHome}/bin/NeoXMLUtils CreateDB_batch ${sNeoHome}/config ${sPassWd} AC_ON");
36 }
37 #---------------------------------------------------------------------
38 # getStatus
39 #---------------------------------------------------------------------
40 sub getStatus()
41 {
42 my (oSelf) = @_;
43 open(IN,
44 '/usr/openwin/bin/xterm -e ps -ef | ' .
45 'grep NeoServer | grep -v grep | cut -d\"/\" -f6 | cut -c1-9 |')
46 or die($!);
47 my $sRes = <IN>;
48 close IN;
49 chomp($sRes);
50 return ( $sRes eq 'NeoServer') 1: 0; # server is running or not
51 }
52 1;
53 __END__