dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #10798
[Branch ~dhis2-documenters/dhis2/dhis2-docbook-docs] Rev 272: Added a script section in the detailed Ubuntu installation chapter
------------------------------------------------------------
revno: 272
committer: bvalbo <heia@xxxxxxxx>
branch nick: dhis2-docbook-docs
timestamp: Wed 2011-03-02 13:37:39 +0100
message:
Added a script section in the detailed Ubuntu installation chapter
modified:
src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml
--
lp:~dhis2-documenters/dhis2/dhis2-docbook-docs
https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs
Your team DHIS 2 developers is subscribed to branch lp:~dhis2-documenters/dhis2/dhis2-docbook-docs.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-documenters/dhis2/dhis2-docbook-docs/+edit-subscription
=== modified file 'src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml'
--- src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml 2011-03-01 14:14:36 +0000
+++ src/docbkx/en/dhis2_implementation_guide_installation_detailed.xml 2011-03-02 12:37:39 +0000
@@ -489,4 +489,55 @@
<screen>sh /usr/local/apache-ÂtomcatÂ7.0.8/bin/shutdown.sh</screen>
</section>
</section>
+ <section>
+ <title>Useful scripts</title>
+ <para>A script can be considered as a "shortcut" in Linux (or any other opreating systems). In a script file, we can write several commands, and by calling the script file, all these commands will be executed automatically.</para>
+ <para>This section will teach you how to create some useful scripts to ease the startup and shutdown process.</para>
+ <section>
+ <title>DHIS 2 start and stop script</title>
+ <para>First of all, it can be wise to create a folder in which we can store all the scripts. I've chosen the folder <code>~/dhis2/scripts</code>. To create this folder, from the terminal, invoke the following command:</para>
+ <para><emphasis>Again, note that</emphasis> <code>~/</code><emphasis> points to your local home folder. The full address will be </emphasis><code>/home/your-user-name/dhis2/scripts</code><emphasis>. Ubuntu understands however the </emphasis><code>~/</code><emphasis> shortcut, so it's no problem to use it.</emphasis></para>
+ <screen>mkdir ~/dhis2/scripts</screen>
+ <para>Now we need to tell the system that we have scripts in this folder. We have to add the folder to the <code>PATH</code> environment variable. This can be done by editing the <emphasis role="italic">.bashrc</emphasis> file. Open it by invoking:</para>
+ <screen>gedit .bashrc</screen>
+ <para>At the <emphasis role="italic">
+ <emphasis role="underline">bottom</emphasis>
+ </emphasis> of the file, add the following line:</para>
+ <screen>export PATH=~/dhis2/scripts:$PATH</screen>
+ <para>Then save and exit.</para>
+ <section>
+ <title>The dhis script file</title>
+ <para>To create the file, invoke:</para>
+ <screen>gedit ~/dhis2/scripts/dhis</screen>
+ <para>In the file, paste the following lines:</para>
+ <screen>if [[ $# > 0 && $1 == 'start' ]]
+then
+ sh /usr/local/apache-tomcat-7.0.8/bin/startup.sh
+elif [[ $# > 0 && 1 == 'stop' ]]
+then
+ sh /usr/local/apache-tomcat-7.0.8/bin/startup.sh
+ echo
+ echo Please be patient while DHIS 2 is starting...
+ sleep 1
+ echo Point your web browser to http://localhost:8080/dhis
+ echo
+else
+ echo
+ echo Wrong usage:
+ echo You have to type dhis start or dhis stop
+ echo
+fi</screen>
+ <para><emphasis><emphasis role="bold">Note:</emphasis> If you have installed Apache Tomcat in a different location from what is given in the example, you will need to change the path both places it say </emphasis><code>/usr/local/apache-tomcat-7.0.8/</code><emphasis> in the example.
+ Also, if your war file is not called </emphasis><code>dhis.war</code><emphasis>, but something different, adjust the URL </emphasis><code>http://localhost:8080/dhis</code><emphasis> correspondingly. Note that </emphasis><code>.war</code><emphasis> is not supposed to be in the URL.</emphasis></para>
+ <para/>
+ <para>What's left now, is to make the file executable. To do that, invoke the following two commands from the terminal:</para>
+ <screen>cd ~/dhis2/scripts
+chmod +x dhis</screen>
+ <para/>
+ <para>Now your script is ready to being executed. From the terminal, you can invoke the following commands to start or stop DHIS 2:</para>
+ <screen>dhis start
+dhis stop</screen>
+ </section>
+ </section>
+ </section>
</chapter>