← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 11210: fixed permissions problem with dhis2-startup

 

------------------------------------------------------------
revno: 11210
committer: Bob Jolliffe <bobjolliffe@xxxxxxxxx>
branch nick: dhis2
timestamp: Fri 2013-06-14 14:19:16 +0100
message:
  fixed permissions problem with dhis2-startup
  modified install.sh to reflect latest "best practice" for installing from apt.postgresql.org
modified:
  tools/dhis2-tools-deb/docs/manual.xml
  tools/dhis2-tools-deb/install.sh
  tools/dhis2-tools-deb/pkg/usr/bin/dhis2-instance-create
  tools/dhis2-tools-deb/pkg/usr/bin/dhis2-startup


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'tools/dhis2-tools-deb/docs/manual.xml'
--- tools/dhis2-tools-deb/docs/manual.xml	2013-05-29 11:52:03 +0000
+++ tools/dhis2-tools-deb/docs/manual.xml	2013-06-14 13:19:16 +0000
@@ -16,7 +16,7 @@
       minutes.  Used together they can also be combined into automated scripts to facilitate rapid
       reconstruction of a given configuration.</para>
   </chapter>
-
+  
   <chapter>
     <title>DHIS2 tools</title>
 

=== modified file 'tools/dhis2-tools-deb/install.sh'
--- tools/dhis2-tools-deb/install.sh	2013-05-28 12:06:12 +0000
+++ tools/dhis2-tools-deb/install.sh	2013-06-14 13:19:16 +0000
@@ -1,9 +1,12 @@
 #!/bin/sh
 # set -e
 
-# need to use a ppa for postgres 9.2 and nginx
+# new way to install postgres 9.2 (https://wiki.postgresql.org/wiki/Apt)
+echo "deb http://apt.postgresql.org/pub/repos/apt/ $(lsb_release -sc)-pgdg main" >/etc/apt/sources.list.d/pgdg.list
+wget --quiet -O - http://apt.postgresql.org/pub/repos/apt/ACCC4CF8.asc | sudo apt-key add -
+
+# need to use a ppa for nginx
 sudo apt-get -y install python-software-properties -y
-sudo add-apt-repository ppa:pitti/postgresql -y 
 sudo add-apt-repository ppa:nginx/stable -y 
 sudo apt-get -y update
 

=== modified file 'tools/dhis2-tools-deb/pkg/usr/bin/dhis2-instance-create'
--- tools/dhis2-tools-deb/pkg/usr/bin/dhis2-instance-create	2013-05-28 12:06:12 +0000
+++ tools/dhis2-tools-deb/pkg/usr/bin/dhis2-instance-create	2013-06-14 13:19:16 +0000
@@ -161,7 +161,7 @@
 # setup user crontab
 
 sudo -u $TARGET sh -c "crontab -u $TARGET -" << EOT
-@reboot /usr/bin/dhis2-startup $TARGET
+@reboot CATALINA_BASE=/var/lib/dhis2/$TARGET /usr/bin/dhis2-startup $TARGET
 20 19 * * * /usr/bin/dhis2_backup $TARGET
 21 00 * * * /usr/sbin/logrotate -s $DHIS2HOME/logrotate.status $DHIS2HOME/logrotate.conf
 EOT

=== modified file 'tools/dhis2-tools-deb/pkg/usr/bin/dhis2-startup'
--- tools/dhis2-tools-deb/pkg/usr/bin/dhis2-startup	2013-05-28 12:06:12 +0000
+++ tools/dhis2-tools-deb/pkg/usr/bin/dhis2-startup	2013-06-14 13:19:16 +0000
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 #       ____  __  ______________ 
 #      / __ \/ / / /  _/ ___/__ \
 #     / / / / /_/ // / \__ \__/ /
@@ -13,6 +13,13 @@
 fi
 
 INSTANCE=$1
-
-sudo -u $INSTANCE CATALINA_BASE=/var/lib/dhis2/$INSTANCE /usr/share/tomcat7/bin/startup.sh
-echo "DHIS2 instance starting for $INSTANCE"
\ No newline at end of file
+CATALINA_BASE=/var/lib/dhis2/$INSTANCE
+
+if [ "$USER" == "$INSTANCE" ]
+  then
+    /usr/share/tomcat7/bin/startup.sh
+  else
+    sudo -u $INSTANCE CATALINA_BASE=/var/lib/dhis2/$INSTANCE /usr/share/tomcat7/bin/startup.sh
+fi
+
+echo "DHIS2 instance starting for $INSTANCE"