Ticket #329: rasdaman

File rasdaman, 32.9 KB (added by barboni@…, 12 years ago)
Line 
1<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
2<html xmlns="http://www.w3.org/1999/xhtml">
3
4
5
6
7 <head>
8 <title>
9 the rasdaman raster array database – rasdaman
10 </title>
11 <link rel="search" href="/trac/rasdaman/search" />
12 <link rel="help" href="/trac/rasdaman/wiki/TracGuide" />
13 <link rel="alternate" href="/trac/rasdaman/export/c69b0d3e2f5ee102e153c3cd58902940b99136cf/packaging/rpm/rasdaman.init.in" type="text/plain" title="Original Format" />
14 <link rel="up" href="/trac/rasdaman/browser/packaging/rpm" title="Parent directory" />
15 <link rel="start" href="/trac/rasdaman/wiki" />
16 <link rel="stylesheet" href="/trac/rasdaman/chrome/common/css/trac.css" type="text/css" /><link rel="stylesheet" href="/trac/rasdaman/chrome/common/css/code.css" type="text/css" /><link rel="stylesheet" href="/trac/rasdaman/pygments/trac.css" type="text/css" /><link rel="stylesheet" href="/trac/rasdaman/chrome/common/css/browser.css" type="text/css" /><link rel="stylesheet" href="/trac/rasdaman/chrome/bitten/bitten.css" type="text/css" />
17 <link rel="shortcut icon" href="/trac/rasdaman/chrome/common/trac.ico" type="image/x-icon" />
18 <link rel="icon" href="/trac/rasdaman/chrome/common/trac.ico" type="image/x-icon" />
19 <link type="application/opensearchdescription+xml" rel="search" href="/trac/rasdaman/search/opensearch" title="Search rasdaman" />
20 <script type="text/javascript" src="/trac/rasdaman/chrome/common/js/jquery.js"></script><script type="text/javascript" src="/trac/rasdaman/chrome/common/js/trac.js"></script><script type="text/javascript" src="/trac/rasdaman/chrome/common/js/search.js"></script>
21 <!--[if lt IE 7]>
22 <script type="text/javascript" src="/trac/rasdaman/chrome/common/js/ie_pre7_hacks.js"></script>
23 <![endif]-->
24 </head>
25
26
27
28
29 <head>
30 <title>/packaging/rpm/rasdaman.init.in</title>
31 <script type="text/javascript">
32 jQuery(document).ready(function($) {
33 $(".trac-toggledeleted").show().click(function() {
34 $(this).siblings().find(".trac-deleted").toggle();
35 return false;
36 }).click();
37 $("#jumploc input").hide();
38 $("#jumploc select").change(function () {
39 this.parentNode.parentNode.submit();
40 });
41 });
42 </script>
43 </head>
44 <body>
45 <div id="banner">
46 <div id="header">
47 <a id="logo" href="/trac/rasdaman/wiki/TracIni#header_logo-section"><img src="/trac/rasdaman/chrome/site/trac_logo.png" alt="" /></a>
48 </div>
49 <form id="search" action="/trac/rasdaman/search" method="get">
50 <div>
51 <label for="proj-search">Search:</label>
52 <input type="text" id="proj-search" name="q" size="18" value="" />
53 <input type="submit" value="Search" />
54 </div>
55 </form>
56 <div id="metanav" class="nav">
57 <ul>
58 <li class="first"><a href="/trac/rasdaman/login">Login</a></li><li><a href="/trac/rasdaman/prefs">Preferences</a></li><li><a href="/trac/rasdaman/wiki/TracGuide">Help/Guide</a></li><li><a href="/trac/rasdaman/about">About Trac</a></li><li class="last"><a href="/trac/rasdaman/register">Register</a></li>
59 </ul>
60 </div>
61 </div>
62 <div id="mainnav" class="nav">
63 <ul>
64 <li class="first"><a href="/trac/rasdaman/wiki">Wiki</a></li><li><a href="/trac/rasdaman/timeline">Timeline</a></li><li><a href="/trac/rasdaman/roadmap">Roadmap</a></li><li class="active"><a href="/trac/rasdaman/browser">Browse Source</a></li><li><a href="/trac/rasdaman/report">View Tickets</a></li><li><a href="/trac/rasdaman/newticket">New Ticket</a></li><li><a href="/trac/rasdaman/search">Search</a></li><li><a href="/trac/rasdaman/patchmanager">Patch Manager</a></li><li class="last"><a class="bittencompleted" href="/trac/rasdaman/build">Build Status</a></li>
65 </ul>
66 </div>
67 <div id="main">
68 <div id="ctxtnav" class="nav">
69 <h2>Context Navigation</h2>
70 <ul>
71 <li class="first"><a href="/trac/rasdaman/changeset/bb9112b589b11213fbcc7a4f4a08fca5380d88e0/packaging/rpm/rasdaman.init.in">Last Change</a></li><li><a href="/trac/rasdaman/browser/packaging/rpm/rasdaman.init.in?annotate=blame&amp;rev=bb9112b589b11213fbcc7a4f4a08fca5380d88e0" title="Annotate each line with the last changed revision (this can be time consuming...)">Annotate</a></li><li><a href="/trac/rasdaman/log/packaging/rpm/rasdaman.init.in">Revision Log</a></li><li class="last"><a href="/trac/rasdaman/browser/packaging/rpm/rasdaman.init.in?annotate=coverage&amp;created=bb9112b589b11213fbcc7a4f4a08fca5380d88e0" rel="nofollow" title="Annotate file with test coverage data (if available)">Coverage</a></li>
72 </ul>
73 <hr />
74 </div>
75 <div id="content" class="browser">
76 <h1>
77 <a class="pathentry first" title="Go to root directory" href="/trac/rasdaman/browser">root</a><span class="pathentry sep">/</span><a class="pathentry" title="View packaging" href="/trac/rasdaman/browser/packaging">packaging</a><span class="pathentry sep">/</span><a class="pathentry" title="View rpm" href="/trac/rasdaman/browser/packaging/rpm">rpm</a><span class="pathentry sep">/</span><a class="pathentry" title="View rasdaman.init.in" href="/trac/rasdaman/browser/packaging/rpm/rasdaman.init.in">rasdaman.init.in</a>
78 <br style="clear: both" />
79 </h1>
80 <div id="jumprev">
81 <form action="" method="get">
82 <div>
83 <label for="rev">
84 View revision:</label>
85 <input type="text" id="rev" name="rev" size="6" />
86 </div>
87 </form>
88 </div>
89 <div id="jumploc">
90 <form action="" method="get">
91 <div class="buttons">
92 <label for="preselected">Visit:</label>
93 <select id="preselected" name="preselected">
94 <option selected="selected"></option>
95 <optgroup label="branches">
96 <option value="/trac/rasdaman/browser/?rev=c69b0d3e2f5ee102e153c3cd58902940b99136cf">master</option>
97 </optgroup><optgroup label="tags">
98 <option value="/trac/rasdaman/browser/?rev=osgeolive-6.5">osgeolive-6.5</option><option value="/trac/rasdaman/browser/?rev=v8.0">v8.0</option><option value="/trac/rasdaman/browser/?rev=v8.1">v8.1</option><option value="/trac/rasdaman/browser/?rev=v8.2">v8.2</option><option value="/trac/rasdaman/browser/?rev=v8.2.1">v8.2.1</option><option value="/trac/rasdaman/browser/?rev=v8.3">v8.3</option><option value="/trac/rasdaman/browser/?rev=v8.3.1">v8.3.1</option><option value="/trac/rasdaman/browser/?rev=v8.4.0-rc.1">v8.4.0-rc.1</option>
99 </optgroup>
100 </select>
101 <input type="submit" value="Go!" title="Jump to the chosen preselected path" />
102 </div>
103 </form>
104 </div>
105 <table id="info" summary="Revision info">
106 <tr>
107 <th scope="col">
108 Revision <a href="/trac/rasdaman/changeset/bb9112b589b11213fbcc7a4f4a08fca5380d88e0">bb9112b589b11213fbcc7a4f4a08fca5380d88e0</a>, <span title="6874 bytes">6.7 KB</span>
109 (checked in by www-data &lt;www-data@
&gt;, <a class="timeline" href="/trac/rasdaman/timeline?from=2013-02-14T16%3A50%3A16%2B0100&amp;precision=second" title="2013-02-14T16:50:16+0100 in Timeline">3 weeks</a> ago)
110 </th>
111 </tr>
112 <tr>
113 <td class="message searchable">
114 <p>
115Update RPM spec file to package the scripts/data for updating RASBASE<br />
116</p>
117 </td>
118 </tr>
119 <tr>
120 <td colspan="2">
121 <ul class="props">
122 <li>
123 Property <strong>mode</strong> set to
124 <em><code>100644</code></em>
125 </li>
126 </ul>
127 </td>
128 </tr>
129 </table>
130 <div id="preview" class="searchable">
131 <table class="code"><thead><tr><th class="lineno" title="Line numbers">Line</th><th class="content"> </th></tr></thead><tbody><tr><th id="L1"><a href="#L1">1</a></th><td>#!/bin/bash</td></tr><tr><th id="L2"><a href="#L2">2</a></th><td>#</td></tr><tr><th id="L3"><a href="#L3">3</a></th><td># rasdaman     Startup script for the Rasdaman Server</td></tr><tr><th id="L4"><a href="#L4">4</a></th><td>#</td></tr><tr><th id="L5"><a href="#L5">5</a></th><td># chkconfig: - 64 36</td></tr><tr><th id="L6"><a href="#L6">6</a></th><td># description: Starts and stops the rasdaman server, and allows to initialize the database.</td></tr><tr><th id="L7"><a href="#L7">7</a></th><td># processname: rasdaman</td></tr><tr><th id="L8"><a href="#L8">8</a></th><td># config: /etc/rasdaman/rasmgr.conf</td></tr><tr><th id="L9"><a href="#L9">9</a></th><td># config: /etc/sysconfig/rasdaman</td></tr><tr><th id="L10"><a href="#L10">10</a></th><td># pidfile: /var/run/rasdaman.pid</td></tr><tr><th id="L11"><a href="#L11">11</a></th><td>#</td></tr><tr><th id="L12"><a href="#L12">12</a></th><td>### BEGIN INIT INFO</td></tr><tr><th id="L13"><a href="#L13">13</a></th><td># Provides: rasdaman</td></tr><tr><th id="L14"><a href="#L14">14</a></th><td># Required-Start: $postgresql</td></tr><tr><th id="L15"><a href="#L15">15</a></th><td># Required-Stop:</td></tr><tr><th id="L16"><a href="#L16">16</a></th><td># Should-Start: distcache</td></tr><tr><th id="L17"><a href="#L17">17</a></th><td># Short-Description: Starts and stops the rasdaman server, and allows to initialize the database.</td></tr><tr><th id="L18"><a href="#L18">18</a></th><td># Description: The rasdaman server is a raster data manager.</td></tr><tr><th id="L19"><a href="#L19">19</a></th><td>### END INIT INFO</td></tr><tr><th id="L20"><a href="#L20">20</a></th><td></td></tr><tr><th id="L21"><a href="#L21">21</a></th><td># Version from spec</td></tr><tr><th id="L22"><a href="#L22">22</a></th><td>RASVERSION=@RASVERSION@</td></tr><tr><th id="L23"><a href="#L23">23</a></th><td># RASMAJORVERSION is major version, e.g., 8.0 (this should match RAS_VERSION)</td></tr><tr><th id="L24"><a href="#L24">24</a></th><td>RASMAJORVERSION=`echo "$RASVERSION" | sed 's/^\([0-9]*\.[0-9]*\).*$/\1/'`</td></tr><tr><th id="L25"><a href="#L25">25</a></th><td></td></tr><tr><th id="L26"><a href="#L26">26</a></th><td># Names for messages</td></tr><tr><th id="L27"><a href="#L27">27</a></th><td>prog=rasdaman</td></tr><tr><th id="L28"><a href="#L28">28</a></th><td></td></tr><tr><th id="L29"><a href="#L29">29</a></th><td># Source function library</td></tr><tr><th id="L30"><a href="#L30">30</a></th><td>. /etc/rc.d/init.d/functions</td></tr><tr><th id="L31"><a href="#L31">31</a></th><td># Source variables for rasdaman</td></tr><tr><th id="L32"><a href="#L32">32</a></th><td>if [ -f /etc/sysconfig/rasdaman ]; then</td></tr><tr><th id="L33"><a href="#L33">33</a></th><td>        . /etc/sysconfig/rasdaman</td></tr><tr><th id="L34"><a href="#L34">34</a></th><td>fi</td></tr><tr><th id="L35"><a href="#L35">35</a></th><td></td></tr><tr><th id="L36"><a href="#L36">36</a></th><td># Reset empty to defaults</td></tr><tr><th id="L37"><a href="#L37">37</a></th><td>rasmgr=${RASMGR-/usr/bin/rasmgr}</td></tr><tr><th id="L38"><a href="#L38">38</a></th><td>rasdl=${RASMGR-/usr/bin/rasdl}</td></tr><tr><th id="L39"><a href="#L39">39</a></th><td>rasctrl=${RASCONTROL-/usr/bin/rascontrol}</td></tr><tr><th id="L40"><a href="#L40">40</a></th><td>pidfile=${PIDFILE-/var/run/rasdaman.pid}</td></tr><tr><th id="L41"><a href="#L41">41</a></th><td>lockfile=${LOCKFILE-/var/lock/subsys/rasdaman}</td></tr><tr><th id="L42"><a href="#L42">42</a></th><td>wait_for_children=${WAIT_FOR_CHILDREN-5}</td></tr><tr><th id="L43"><a href="#L43">43</a></th><td>servers=${RASSERVERS-"-all"}</td></tr><tr><th id="L44"><a href="#L44">44</a></th><td>raslogin=${RASADMIN-rasadmin:d293a15562d3e70b6fdc5ee452eaed40}</td></tr><tr><th id="L45"><a href="#L45">45</a></th><td>rasdir=${RASDIR-/var/lib/rasdaman}</td></tr><tr><th id="L46"><a href="#L46">46</a></th><td>raslogdir=${RASLOGDIR-/var/log/rasdaman}</td></tr><tr><th id="L47"><a href="#L47">47</a></th><td>rasshell=${RASSHELL-/bin/bash}</td></tr><tr><th id="L48"><a href="#L48">48</a></th><td>petapath=${PETASCOPE_PATH-/usr/share/rasdaman/petascope}</td></tr><tr><th id="L49"><a href="#L49">49</a></th><td></td></tr><tr><th id="L50"><a href="#L50">50</a></th><td># To check if postgres cluster was initialized</td></tr><tr><th id="L51"><a href="#L51">51</a></th><td># we need this and we fetch it from our sysconfig not postgres one</td></tr><tr><th id="L52"><a href="#L52">52</a></th><td>PGDATA=${PGDATA-/mnt/mea-disk/pgdata}</td></tr><tr><th id="L53"><a href="#L53">53</a></th><td></td></tr><tr><th id="L54"><a href="#L54">54</a></th><td>RETVAL=0</td></tr><tr><th id="L55"><a href="#L55">55</a></th><td></td></tr><tr><th id="L56"><a href="#L56">56</a></th><td># For SELinux we need to use 'runuser' not 'su'</td></tr><tr><th id="L57"><a href="#L57">57</a></th><td>if [ -x /sbin/runuser ]</td></tr><tr><th id="L58"><a href="#L58">58</a></th><td>then</td></tr><tr><th id="L59"><a href="#L59">59</a></th><td>    SU=runuser</td></tr><tr><th id="L60"><a href="#L60">60</a></th><td>else</td></tr><tr><th id="L61"><a href="#L61">61</a></th><td>    SU=su</td></tr><tr><th id="L62"><a href="#L62">62</a></th><td>fi</td></tr><tr><th id="L63"><a href="#L63">63</a></th><td></td></tr><tr><th id="L64"><a href="#L64">64</a></th><td>raslog=$rasdir/startup.log</td></tr><tr><th id="L65"><a href="#L65">65</a></th><td>rascontrol="RASLOGIN=$raslogin $rasctrl"</td></tr><tr><th id="L66"><a href="#L66">66</a></th><td>deffile=$rasdir/basictypes.dl</td></tr><tr><th id="L67"><a href="#L67">67</a></th><td></td></tr><tr><th id="L68"><a href="#L68">68</a></th><td># The semantics of these two functions differ from the way apachectl does</td></tr><tr><th id="L69"><a href="#L69">69</a></th><td># things -- attempting to start while running is a failure, and shutdown</td></tr><tr><th id="L70"><a href="#L70">70</a></th><td># when not running is also a failure.  So we just do it the way init scripts</td></tr><tr><th id="L71"><a href="#L71">71</a></th><td># are expected to behave here.</td></tr><tr><th id="L72"><a href="#L72">72</a></th><td>start() {</td></tr><tr><th id="L73"><a href="#L73">73</a></th><td>  chown -R rasdaman:rasdaman "$raslogdir"</td></tr><tr><th id="L74"><a href="#L74">74</a></th><td>  # Make sure startup-time log file is valid</td></tr><tr><th id="L75"><a href="#L75">75</a></th><td>  if [ ! -e "$raslog" -a ! -h "$raslog" ]</td></tr><tr><th id="L76"><a href="#L76">76</a></th><td>  then</td></tr><tr><th id="L77"><a href="#L77">77</a></th><td>    touch "$raslog" || exit 1</td></tr><tr><th id="L78"><a href="#L78">78</a></th><td>    chown rasdaman:rasdaman "$raslog"</td></tr><tr><th id="L79"><a href="#L79">79</a></th><td>    chmod go-rwx "$raslog"</td></tr><tr><th id="L80"><a href="#L80">80</a></th><td>    [ -x /usr/bin/chcon ] &amp;&amp; /usr/bin/chcon -u system_u -r object_r -t postgresql_log_t "$raslog" 2&gt;/dev/null</td></tr><tr><th id="L81"><a href="#L81">81</a></th><td>  fi</td></tr><tr><th id="L82"><a href="#L82">82</a></th><td></td></tr><tr><th id="L83"><a href="#L83">83</a></th><td>  # Check for the PGDATA structure</td></tr><tr><th id="L84"><a href="#L84">84</a></th><td>  if [ -f "$PGDATA/PG_VERSION" ] &amp;&amp; [ -d "$PGDATA/base" ]</td></tr><tr><th id="L85"><a href="#L85">85</a></th><td>  then</td></tr><tr><th id="L86"><a href="#L86">86</a></th><td>    echo</td></tr><tr><th id="L87"><a href="#L87">87</a></th><td>    echo $"PostgreSQL database was found."</td></tr><tr><th id="L88"><a href="#L88">88</a></th><td>    echo $"Version is not checked here."</td></tr><tr><th id="L89"><a href="#L89">89</a></th><td>    echo $"Location $PGDATA."</td></tr><tr><th id="L90"><a href="#L90">90</a></th><td>  else</td></tr><tr><th id="L91"><a href="#L91">91</a></th><td>    # No existing PGDATA! Warn the user to initdb it.</td></tr><tr><th id="L92"><a href="#L92">92</a></th><td>    echo</td></tr><tr><th id="L93"><a href="#L93">93</a></th><td>    echo "$PGDATA is missing. Use \"service rasmgr initdb\" to initialize the cluster first."</td></tr><tr><th id="L94"><a href="#L94">94</a></th><td>    echo "PostgreSQL database will be initialized automatically."</td></tr><tr><th id="L95"><a href="#L95">95</a></th><td>    echo_failure</td></tr><tr><th id="L96"><a href="#L96">96</a></th><td>    echo</td></tr><tr><th id="L97"><a href="#L97">97</a></th><td>    exit 1</td></tr><tr><th id="L98"><a href="#L98">98</a></th><td>  fi</td></tr><tr><th id="L99"><a href="#L99">99</a></th><td></td></tr><tr><th id="L100"><a href="#L100">100</a></th><td>  echo -n $"Starting $prog: "</td></tr><tr><th id="L101"><a href="#L101">101</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "$rasmgr &amp;" &gt;&gt; "$raslog" 2&gt;&amp;1 &lt; /dev/null</td></tr><tr><th id="L102"><a href="#L102">102</a></th><td>  RETVAL=$?</td></tr><tr><th id="L103"><a href="#L103">103</a></th><td>  if [[ $RETVAL = 0 ]]</td></tr><tr><th id="L104"><a href="#L104">104</a></th><td>  then</td></tr><tr><th id="L105"><a href="#L105">105</a></th><td>    echo</td></tr><tr><th id="L106"><a href="#L106">106</a></th><td>    touch ${lockfile}</td></tr><tr><th id="L107"><a href="#L107">107</a></th><td>    pidof -s "$rasmgr" &gt; ${pidfile}</td></tr><tr><th id="L108"><a href="#L108">108</a></th><td>  fi</td></tr><tr><th id="L109"><a href="#L109">109</a></th><td></td></tr><tr><th id="L110"><a href="#L110">110</a></th><td>  sleep $wait_for_children</td></tr><tr><th id="L111"><a href="#L111">111</a></th><td></td></tr><tr><th id="L112"><a href="#L112">112</a></th><td>  for SRV in $servers</td></tr><tr><th id="L113"><a href="#L113">113</a></th><td>  do</td></tr><tr><th id="L114"><a href="#L114">114</a></th><td>    echo $"$rasctrl: starting server $SRV..."</td></tr><tr><th id="L115"><a href="#L115">115</a></th><td>    $SU -l rasdaman -s "$rasshell" -c "$rascontrol -e -q -x up srv $SRV" &gt;&gt; "$raslog" 2&gt;&amp;1 &lt; /dev/null</td></tr><tr><th id="L116"><a href="#L116">116</a></th><td>    RETVAL=$?</td></tr><tr><th id="L117"><a href="#L117">117</a></th><td>    if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L118"><a href="#L118">118</a></th><td>    then</td></tr><tr><th id="L119"><a href="#L119">119</a></th><td>      exit $!</td></tr><tr><th id="L120"><a href="#L120">120</a></th><td>    fi</td></tr><tr><th id="L121"><a href="#L121">121</a></th><td>  done</td></tr><tr><th id="L122"><a href="#L122">122</a></th><td></td></tr><tr><th id="L123"><a href="#L123">123</a></th><td>  return $RETVAL</td></tr><tr><th id="L124"><a href="#L124">124</a></th><td>}</td></tr><tr><th id="L125"><a href="#L125">125</a></th><td></td></tr><tr><th id="L126"><a href="#L126">126</a></th><td># When stopping httpd a delay of &gt;10 second is required before SIGKILLing the</td></tr><tr><th id="L127"><a href="#L127">127</a></th><td># httpd parent; this gives enough time for the httpd parent to SIGKILL any</td></tr><tr><th id="L128"><a href="#L128">128</a></th><td># errant children.</td></tr><tr><th id="L129"><a href="#L129">129</a></th><td>stop() {</td></tr><tr><th id="L130"><a href="#L130">130</a></th><td>  running=`$SU -l rasdaman -s "$rasshell" -c "$rascontrol -e -q -x list srv | awk '{ if (\\$6 == \"UP\") print \\$2;}'"`</td></tr><tr><th id="L131"><a href="#L131">131</a></th><td>  for SRV in $running</td></tr><tr><th id="L132"><a href="#L132">132</a></th><td>  do</td></tr><tr><th id="L133"><a href="#L133">133</a></th><td>    echo $"$rasctrl: stoping server $SRV..."</td></tr><tr><th id="L134"><a href="#L134">134</a></th><td>    $SU -l rasdaman -s "$rasshell" -c "$rascontrol -e -q -x down srv $SRV -kill" &gt;&gt; "$raslog" 2&gt;&amp;1 &lt; /dev/null</td></tr><tr><th id="L135"><a href="#L135">135</a></th><td>  done</td></tr><tr><th id="L136"><a href="#L136">136</a></th><td></td></tr><tr><th id="L137"><a href="#L137">137</a></th><td>  sleep $wait_for_children</td></tr><tr><th id="L138"><a href="#L138">138</a></th><td></td></tr><tr><th id="L139"><a href="#L139">139</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "$rascontrol -e -q -x down host -all" &gt;&gt; "$raslog" 2&gt;&amp;1 &lt; /dev/null</td></tr><tr><th id="L140"><a href="#L140">140</a></th><td></td></tr><tr><th id="L141"><a href="#L141">141</a></th><td>  RETVAL=$?</td></tr><tr><th id="L142"><a href="#L142">142</a></th><td></td></tr><tr><th id="L143"><a href="#L143">143</a></th><td>  [ $RETVAL = 0 ] &amp;&amp; rm -f ${lockfile} ${pidfile}</td></tr><tr><th id="L144"><a href="#L144">144</a></th><td>}</td></tr><tr><th id="L145"><a href="#L145">145</a></th><td></td></tr><tr><th id="L146"><a href="#L146">146</a></th><td>#</td></tr><tr><th id="L147"><a href="#L147">147</a></th><td># Initializes RASBASE</td></tr><tr><th id="L148"><a href="#L148">148</a></th><td>#</td></tr><tr><th id="L149"><a href="#L149">149</a></th><td>initdb(){</td></tr><tr><th id="L150"><a href="#L150">150</a></th><td>  bhostname=`hostname`</td></tr><tr><th id="L151"><a href="#L151">151</a></th><td>  mv /etc/rasdaman/rasmgr.conf /etc/rasdaman/rasmgr.conf.init</td></tr><tr><th id="L152"><a href="#L152">152</a></th><td>  cat /etc/rasdaman/rasmgr.conf.init | sed -e "s/ -host [^ ]*/ -host $bhostname/g" &gt; /etc/rasdaman/rasmgr.conf</td></tr><tr><th id="L153"><a href="#L153">153</a></th><td></td></tr><tr><th id="L154"><a href="#L154">154</a></th><td>  ##service postgresql initdb</td></tr><tr><th id="L155"><a href="#L155">155</a></th><td>  ##service postgresql start</td></tr><tr><th id="L156"><a href="#L156">156</a></th><td></td></tr><tr><th id="L157"><a href="#L157">157</a></th><td>  # create rasdaman user in postgres</td></tr><tr><th id="L158"><a href="#L158">158</a></th><td>  $SU -l postgres -c "createuser -d -r -S rasdaman"</td></tr><tr><th id="L159"><a href="#L159">159</a></th><td>  RETVAL=$?</td></tr><tr><th id="L160"><a href="#L160">160</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L161"><a href="#L161">161</a></th><td>  then</td></tr><tr><th id="L162"><a href="#L162">162</a></th><td>    echo $"creating rasdaman user in postgres failed"</td></tr><tr><th id="L163"><a href="#L163">163</a></th><td>    exit $!</td></tr><tr><th id="L164"><a href="#L164">164</a></th><td>  fi</td></tr><tr><th id="L165"><a href="#L165">165</a></th><td></td></tr><tr><th id="L166"><a href="#L166">166</a></th><td>  # create database</td></tr><tr><th id="L167"><a href="#L167">167</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "createdb RASBASE"</td></tr><tr><th id="L168"><a href="#L168">168</a></th><td>  RETVAL=$?</td></tr><tr><th id="L169"><a href="#L169">169</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L170"><a href="#L170">170</a></th><td>  then</td></tr><tr><th id="L171"><a href="#L171">171</a></th><td>    echo $"creating RASBASE in postgres failed"</td></tr><tr><th id="L172"><a href="#L172">172</a></th><td>    exit $!</td></tr><tr><th id="L173"><a href="#L173">173</a></th><td>  fi</td></tr><tr><th id="L174"><a href="#L174">174</a></th><td></td></tr><tr><th id="L175"><a href="#L175">175</a></th><td>  # insert type definitions</td></tr><tr><th id="L176"><a href="#L176">176</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "$rasdl -c --connect RASBASE &amp;&amp; $rasdl -r $deffile -i --connect RASBASE"</td></tr><tr><th id="L177"><a href="#L177">177</a></th><td>  RETVAL=$?</td></tr><tr><th id="L178"><a href="#L178">178</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L179"><a href="#L179">179</a></th><td>  then</td></tr><tr><th id="L180"><a href="#L180">180</a></th><td>    echo $"inserting type definitions to rasdaman with rasdl failed"</td></tr><tr><th id="L181"><a href="#L181">181</a></th><td>    exit $!</td></tr><tr><th id="L182"><a href="#L182">182</a></th><td>  fi</td></tr><tr><th id="L183"><a href="#L183">183</a></th><td>}</td></tr><tr><th id="L184"><a href="#L184">184</a></th><td></td></tr><tr><th id="L185"><a href="#L185">185</a></th><td>#</td></tr><tr><th id="L186"><a href="#L186">186</a></th><td># Update RASBASE</td></tr><tr><th id="L187"><a href="#L187">187</a></th><td>#</td></tr><tr><th id="L188"><a href="#L188">188</a></th><td>updatedb()</td></tr><tr><th id="L189"><a href="#L189">189</a></th><td>{</td></tr><tr><th id="L190"><a href="#L190">190</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "update_db.sh"</td></tr><tr><th id="L191"><a href="#L191">191</a></th><td>}</td></tr><tr><th id="L192"><a href="#L192">192</a></th><td></td></tr><tr><th id="L193"><a href="#L193">193</a></th><td>#</td></tr><tr><th id="L194"><a href="#L194">194</a></th><td># Initializes/updates the petascope database</td></tr><tr><th id="L195"><a href="#L195">195</a></th><td>#</td></tr><tr><th id="L196"><a href="#L196">196</a></th><td>initpetascopedb(){</td></tr><tr><th id="L197"><a href="#L197">197</a></th><td>  # create petascope user in postgres</td></tr><tr><th id="L198"><a href="#L198">198</a></th><td>  $SU -l postgres -c "createuser -SRd tomcat6"</td></tr><tr><th id="L199"><a href="#L199">199</a></th><td>  RETVAL=$?</td></tr><tr><th id="L200"><a href="#L200">200</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L201"><a href="#L201">201</a></th><td>  then</td></tr><tr><th id="L202"><a href="#L202">202</a></th><td>    echo $"creating petascope user in postgres failed"</td></tr><tr><th id="L203"><a href="#L203">203</a></th><td>    exit $!</td></tr><tr><th id="L204"><a href="#L204">204</a></th><td>  fi</td></tr><tr><th id="L205"><a href="#L205">205</a></th><td></td></tr><tr><th id="L206"><a href="#L206">206</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "update_petascopedb.sh"</td></tr><tr><th id="L207"><a href="#L207">207</a></th><td>}</td></tr><tr><th id="L208"><a href="#L208">208</a></th><td></td></tr><tr><th id="L209"><a href="#L209">209</a></th><td>#</td></tr><tr><th id="L210"><a href="#L210">210</a></th><td># Drop RASBASE</td></tr><tr><th id="L211"><a href="#L211">211</a></th><td>#</td></tr><tr><th id="L212"><a href="#L212">212</a></th><td>dropdb(){</td></tr><tr><th id="L213"><a href="#L213">213</a></th><td>  echo dropping RASBASE...</td></tr><tr><th id="L214"><a href="#L214">214</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "dropdb RASBASE"</td></tr><tr><th id="L215"><a href="#L215">215</a></th><td>  RETVAL=$?</td></tr><tr><th id="L216"><a href="#L216">216</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L217"><a href="#L217">217</a></th><td>  then</td></tr><tr><th id="L218"><a href="#L218">218</a></th><td>    echo $"dropdb failed"</td></tr><tr><th id="L219"><a href="#L219">219</a></th><td>    exit $!</td></tr><tr><th id="L220"><a href="#L220">220</a></th><td>  fi</td></tr><tr><th id="L221"><a href="#L221">221</a></th><td>  echo dropping user...</td></tr><tr><th id="L222"><a href="#L222">222</a></th><td>  $SU -l postgres -c "dropuser rasdaman"</td></tr><tr><th id="L223"><a href="#L223">223</a></th><td>  RETVAL=$?</td></tr><tr><th id="L224"><a href="#L224">224</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L225"><a href="#L225">225</a></th><td>  then</td></tr><tr><th id="L226"><a href="#L226">226</a></th><td>    echo $"drop user failed"</td></tr><tr><th id="L227"><a href="#L227">227</a></th><td>    exit $!</td></tr><tr><th id="L228"><a href="#L228">228</a></th><td>  fi</td></tr><tr><th id="L229"><a href="#L229">229</a></th><td>}</td></tr><tr><th id="L230"><a href="#L230">230</a></th><td></td></tr><tr><th id="L231"><a href="#L231">231</a></th><td>#</td></tr><tr><th id="L232"><a href="#L232">232</a></th><td># Drop the petascope database</td></tr><tr><th id="L233"><a href="#L233">233</a></th><td>#</td></tr><tr><th id="L234"><a href="#L234">234</a></th><td>droppetascopedb(){</td></tr><tr><th id="L235"><a href="#L235">235</a></th><td>  echo dropping petascopedb...</td></tr><tr><th id="L236"><a href="#L236">236</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "dropdb petascopedb"</td></tr><tr><th id="L237"><a href="#L237">237</a></th><td>  RETVAL=$?</td></tr><tr><th id="L238"><a href="#L238">238</a></th><td>  if [[ $RETVAL != 0 ]]</td></tr><tr><th id="L239"><a href="#L239">239</a></th><td>  then</td></tr><tr><th id="L240"><a href="#L240">240</a></th><td>    echo $"dropdb failed"</td></tr><tr><th id="L241"><a href="#L241">241</a></th><td>    exit $!</td></tr><tr><th id="L242"><a href="#L242">242</a></th><td>  fi</td></tr><tr><th id="L243"><a href="#L243">243</a></th><td>}</td></tr><tr><th id="L244"><a href="#L244">244</a></th><td></td></tr><tr><th id="L245"><a href="#L245">245</a></th><td># See how we were called.</td></tr><tr><th id="L246"><a href="#L246">246</a></th><td>case "$1" in</td></tr><tr><th id="L247"><a href="#L247">247</a></th><td>  start)</td></tr><tr><th id="L248"><a href="#L248">248</a></th><td>  start</td></tr><tr><th id="L249"><a href="#L249">249</a></th><td>  ;;</td></tr><tr><th id="L250"><a href="#L250">250</a></th><td>  stop)</td></tr><tr><th id="L251"><a href="#L251">251</a></th><td>  stop</td></tr><tr><th id="L252"><a href="#L252">252</a></th><td>  ;;</td></tr><tr><th id="L253"><a href="#L253">253</a></th><td>  status)</td></tr><tr><th id="L254"><a href="#L254">254</a></th><td>  status -p ${pidfile} $rasmgr</td></tr><tr><th id="L255"><a href="#L255">255</a></th><td>  $SU -l rasdaman -s "$rasshell" -c "$rascontrol -e -q -x list srv"</td></tr><tr><th id="L256"><a href="#L256">256</a></th><td>  RETVAL=$?</td></tr><tr><th id="L257"><a href="#L257">257</a></th><td>  ;;</td></tr><tr><th id="L258"><a href="#L258">258</a></th><td>  restart)</td></tr><tr><th id="L259"><a href="#L259">259</a></th><td>  stop</td></tr><tr><th id="L260"><a href="#L260">260</a></th><td>  start</td></tr><tr><th id="L261"><a href="#L261">261</a></th><td>  ;;</td></tr><tr><th id="L262"><a href="#L262">262</a></th><td>  condrestart)</td></tr><tr><th id="L263"><a href="#L263">263</a></th><td>  if status -p ${pidfile} $rasmgr &gt;&amp;/dev/null; then</td></tr><tr><th id="L264"><a href="#L264">264</a></th><td>    stop</td></tr><tr><th id="L265"><a href="#L265">265</a></th><td>    start</td></tr><tr><th id="L266"><a href="#L266">266</a></th><td>  fi</td></tr><tr><th id="L267"><a href="#L267">267</a></th><td>  ;;</td></tr><tr><th id="L268"><a href="#L268">268</a></th><td>  initdb)</td></tr><tr><th id="L269"><a href="#L269">269</a></th><td>  initdb</td></tr><tr><th id="L270"><a href="#L270">270</a></th><td>  ;;</td></tr><tr><th id="L271"><a href="#L271">271</a></th><td>  updatedb)</td></tr><tr><th id="L272"><a href="#L272">272</a></th><td>  updatedb</td></tr><tr><th id="L273"><a href="#L273">273</a></th><td>  ;;</td></tr><tr><th id="L274"><a href="#L274">274</a></th><td>  initpetascopedb)</td></tr><tr><th id="L275"><a href="#L275">275</a></th><td>  initpetascopedb</td></tr><tr><th id="L276"><a href="#L276">276</a></th><td>  ;;</td></tr><tr><th id="L277"><a href="#L277">277</a></th><td>  updatepetascopedb)</td></tr><tr><th id="L278"><a href="#L278">278</a></th><td>  initpetascopedb</td></tr><tr><th id="L279"><a href="#L279">279</a></th><td>  ;;</td></tr><tr><th id="L280"><a href="#L280">280</a></th><td>  dropdb)</td></tr><tr><th id="L281"><a href="#L281">281</a></th><td>  dropdb</td></tr><tr><th id="L282"><a href="#L282">282</a></th><td>  ;;</td></tr><tr><th id="L283"><a href="#L283">283</a></th><td>  droppetascopedb)</td></tr><tr><th id="L284"><a href="#L284">284</a></th><td>  droppetascopedb</td></tr><tr><th id="L285"><a href="#L285">285</a></th><td>  ;;</td></tr><tr><th id="L286"><a href="#L286">286</a></th><td>  *)</td></tr><tr><th id="L287"><a href="#L287">287</a></th><td>  echo $"Usage: $prog {start|stop|restart|condrestart|status|initdb|updatedb|dropdb|initpetascopedb|updatepetascopedb|droppetascopedb}"</td></tr><tr><th id="L288"><a href="#L288">288</a></th><td>  RETVAL=3</td></tr><tr><th id="L289"><a href="#L289">289</a></th><td>esac</td></tr><tr><th id="L290"><a href="#L290">290</a></th><td></td></tr><tr><th id="L291"><a href="#L291">291</a></th><td>exit $RETVAL</td></tr></tbody></table>
132 </div>
133 <div id="help">
134 <strong>Note:</strong> See <a href="/trac/rasdaman/wiki/TracBrowser">TracBrowser</a>
135 for help on using the browser.
136 </div>
137 <div id="anydiff">
138 <form action="/trac/rasdaman/diff" method="get">
139 <div class="buttons">
140 <input type="hidden" name="new_path" value="/packaging/rpm/rasdaman.init.in" />
141 <input type="hidden" name="old_path" value="/packaging/rpm/rasdaman.init.in" />
142 <input type="hidden" name="new_rev" />
143 <input type="hidden" name="old_rev" />
144 <input type="submit" value="View changes..." title="Select paths and revs for Diff" />
145 </div>
146 </form>
147 </div>
148 </div>
149 <div id="altlinks">
150 <h3>Download in other formats:</h3>
151 <ul>
152 <li class="last first">
153 <a rel="nofollow" href="/trac/rasdaman/export/c69b0d3e2f5ee102e153c3cd58902940b99136cf/packaging/rpm/rasdaman.init.in">Original Format</a>
154 </li>
155 </ul>
156 </div>
157 </div>
158 <div id="footer" lang="en" xml:lang="en"><hr />
159 <a id="tracpowered" href="http://trac.edgewall.org/"><img src="/trac/rasdaman/chrome/common/trac_logo_mini.png" height="30" width="107" alt="Trac Powered" /></a>
160 <p class="left">
161 Powered by <a href="/trac/rasdaman/about"><strong>Trac 0.11.5</strong></a><br />
162 By <a href="http://www.edgewall.org/">Edgewall Software</a>.
163 </p>
164 <p class="right">Visit the Trac open source project at<br /><a href="http://trac.edgewall.org/">http://trac.edgewall.org/</a></p>
165 </div>
166 </body>
167</html>