=== 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 @@ sh /usr/local/apache-­tomcat­7.0.8/bin/shutdown.sh +
+ Useful scripts + 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. + This section will teach you how to create some useful scripts to ease the startup and shutdown process. +
+ DHIS 2 start and stop script + First of all, it can be wise to create a folder in which we can store all the scripts. I've chosen the folder ~/dhis2/scripts. To create this folder, from the terminal, invoke the following command: + Again, note that ~/ points to your local home folder. The full address will be /home/your-user-name/dhis2/scripts. Ubuntu understands however the ~/ shortcut, so it's no problem to use it. + mkdir ~/dhis2/scripts + Now we need to tell the system that we have scripts in this folder. We have to add the folder to the PATH environment variable. This can be done by editing the .bashrc file. Open it by invoking: + gedit .bashrc + At the + bottom + of the file, add the following line: + export PATH=~/dhis2/scripts:$PATH + Then save and exit. +
+ The dhis script file + To create the file, invoke: + gedit ~/dhis2/scripts/dhis + In the file, paste the following lines: + 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 + Note: 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 /usr/local/apache-tomcat-7.0.8/ in the example. + Also, if your war file is not called dhis.war, but something different, adjust the URL http://localhost:8080/dhis correspondingly. Note that .war is not supposed to be in the URL. + + What's left now, is to make the file executable. To do that, invoke the following two commands from the terminal: + cd ~/dhis2/scripts +chmod +x dhis + + Now your script is ready to being executed. From the terminal, you can invoke the following commands to start or stop DHIS 2: + dhis start +dhis stop +
+
+