Advertisement
sibeth

start_rasdaman.sh

Jan 16th, 2014
56
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.96 KB | None | 0 0
  1. cat /home/rasdaman/install/bin/start_rasdaman.sh
  2. #!/bin/bash
  3. #
  4. # This file is part of rasdaman community.
  5. #
  6. # Rasdaman community is free software: you can redistribute it and/or modify
  7. # it under the terms of the GNU General Public License as published by
  8. # the Free Software Foundation, either version 3 of the License, or
  9. # (at your option) any later version.
  10. #
  11. # Rasdaman community is distributed in the hope that it will be useful,
  12. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. # GNU General Public License for more details.
  15. #
  16. # You should have received a copy of the GNU General Public License
  17. # along with rasdaman community. If not, see <http://www.gnu.org/licenses/>.
  18. #
  19. # Copyright 2003, 2004, 2005, 2006, 2007, 2008, 2009 Peter Baumann /
  20. # rasdaman GmbH.
  21. #
  22. # For more information please see <http://www.rasdaman.org>
  23. # or contact Peter Baumann via <baumann@rasdaman.com>.
  24. #
  25.  
  26. #
  27. # start_rasdaman.sh - start rasdaman server complex
  28. #
  29. # SYNTAX
  30. # start_rasdaman.sh [servers...]
  31. #
  32. # DESCRIPTION
  33. # This script starts rasdaman.
  34. # Which rasdaman servers are started depends on the 'server' name(s) provided:
  35. # * If no server name is provided then the environment variable $RASSERVERS is
  36. # inspected to obtain a list of servers to be started. If $RASSERVERS is not
  37. # set, then all rasdaman servers defined will be attempted to start.
  38. # * If at least one parameter is provided then all parameters
  39. # will be treated as a server name which is tried to be started.
  40. #
  41. # One possible reason while not all servers may come up is that more servers
  42. # might be defined than your licence model allows to run in parallel.
  43. #
  44. # To log in to the server, the external variable $RASLOGIN is expected to hold
  45. # an ID string (see rasdaman manual). If not found, a desperate last attempt is
  46. # made to login as rasadmin/rasadmin. If this fails, no servers are started at all.
  47. #
  48. # PRECONDITIONS
  49. # - need to have a rasdaman admin login either from $RASLOGIN or as rasadmin/rasadmin
  50. # - need to run with an effective user id that allows to write into log/
  51. # - need to have a valid rasdaman installation
  52. #
  53. # RETURN CODES
  54. RC_OK=0 # everything went fine
  55. RC_ERROR=1 # something went wrong
  56.  
  57. # --- CONSTANTS -----------------------------------------------------
  58.  
  59. # sleep time to let rasmgr establish before spawning servers
  60. WAIT_FOR_CHILDREN=5
  61.  
  62. # get script name
  63. MYNAME=`basename $0`
  64.  
  65. # error messages:
  66. ERROR_PARAM="ERS001 Error: illegal parameter: $1"
  67.  
  68. # --- END CONSTANTS -------------------------------------------------
  69.  
  70. # --- ACTION --------------------------------------------------------
  71.  
  72. echo $MYNAME: starting rasdaman server complex...
  73.  
  74. # --- start rasmgr: -------------------------------------------------
  75.  
  76. # here we want to put all log files
  77. cd /home/rasdaman/install/log/
  78.  
  79. # clear previous log file
  80. rm -f nohup.out
  81.  
  82. # start rasdaman server manager as demon; log will go into nohup.out
  83. # the manager is started in quiet mode
  84. nohup /home/rasdaman/install/bin/rasmgr & 2>&1
  85.  
  86. # --- start servers: -------------------------------------------------
  87.  
  88. # allow process to establish
  89. sleep $WAIT_FOR_CHILDREN
  90.  
  91. # these servers will be started:
  92. if [ $1 ]
  93. then
  94. # parameters provided, take them as server names
  95. SERVERS=$*
  96. else
  97. if [ "$RASSERVERS" ]; then
  98. SERVERS=$RASSERVERS
  99. else
  100. SERVERS=""
  101. fi
  102. fi
  103.  
  104. # determine rascontrol login
  105. if [ -z "$RASLOGIN" ]; then
  106. export RASLOGIN=rasadmin:d293a15562d3e70b6fdc5ee452eaed40
  107. fi
  108.  
  109. # ...then spawn server workers
  110. if [ "$SERVERS" ]; then
  111. for SRV in $SERVERS
  112. do
  113. echo -n $MYNAME: starting server $SRV...
  114. /home/rasdaman/install/bin/rascontrol -e -q -x up srv $SRV || exit $!
  115. done
  116. else
  117. echo $MYNAME: starting all rasdaman servers...
  118. /home/rasdaman/install/bin/rascontrol -e -q -x up srv -all || exit $!
  119. fi
  120.  
  121. echo $MYNAME: done.
  122. exit $RC_OK
  123.  
  124. # --- END ACTION ----------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement