]> git.evergreen-ils.org Git - working/random.git/blob - installer/wheezy/eg_wheezy_installer.sh
multi-host support for live tester
[working/random.git] / installer / wheezy / eg_wheezy_installer.sh
1 #!/bin/bash
2 # -----------------------------------------------------------------------
3 # Copyright (C) 2009-2012  Equinox Software Inc.
4 # Bill Erickson <berick@esilibrary.com>
5
6 # This program is free software; you can redistribute it and/or
7 # modify it under the terms of the GNU General Public License
8 # as published by the Free Software Foundation; either version 2
9 # of the License, or (at your option) any later version.
10
11 # This program 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
17 while getopts ayst option
18 do
19         case "${option}"
20         in
21                 a) AUTOSTART=1;;
22                 y) YES=1;;
23                 s) SAMPLEDATA=--load-all-sample;;
24                 t) LIVETEST=1;;
25         esac
26 done
27
28 function my_init {
29     date
30     init_variables
31     configure_timezone
32     configure_cpan
33     build_essentials
34     setting_up_opensrf_env
35     cloning_git_repos
36     opensrf_prereqs
37     evergreen_prereqs
38     evergreen_db_prereqs
39     setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd
40     build_opensrf
41     test_opensrf_build
42     install_opensrf
43     build_evergreen
44     test_evergreen_build
45     test_and_build_eg_browser_client
46     install_evergreen
47     configure_database
48     configure_apache
49     if [ $AUTOSTART ]; then
50         start_evergreen
51         if [ $LIVETEST ]; then
52             test_evergreen_live
53         fi
54     fi
55     docs_builder_prereqs
56     build_the_docs
57 }
58
59 function init_variables {
60     echo _.-~= initializing installer
61     date
62     # -----------------------------------------------------------------------
63     # Handling passed arguments to the script
64     # -----------------------------------------------------------------------
65     export DOJO_VERSION='1.3.3';
66     export PATH=/openils/bin:$PATH
67     export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH
68     export BASE_DIR=$PWD
69     echo AUTOSTART=${AUTOSTART}
70     echo YES=${YES}
71     echo SAMPLEDATA=${SAMPLEDATA}
72     echo LIVETEST=${LIVETEST}
73     echo DOJO_VERSION=${DOJO_VERSION}
74     echo PATH=${PATH}
75     echo LD_LIBRARY_PATH=${LD_LIBRARY_PATH}
76     echo BASE_DIR=${BASE_DIR}
77     # -----------------------------------------------------------------------
78     # Change to suit...
79     # -----------------------------------------------------------------------
80     # If you change the jabber password, you will need to 
81     # edit opensrf_core.xml and srfsh.xml accordingly
82     export JABBER_PASSWORD='password'
83     export ADMIN_USER='admin';
84     export ADMIN_PASS='demo123';
85     # -----------------------------------------------------------------------
86     # Database variables
87     # -----------------------------------------------------------------------
88     export PGDATABASE=evergreen
89     export PGUSER=evergreen
90     export PGPASSWORD=evergreen
91     export PGHOST=localhost
92     # -----------------------------------------------------------------------
93     # You can override these like so:
94     #       EVERGREEN_BRANCH='master' ./eg_wheezy_installer.sh
95     # -----------------------------------------------------------------------
96     OPENSRF_REPO='git://git.evergreen-ils.org/OpenSRF.git'
97     OPENSRF_BRANCH='master'
98     EVERGREEN_REPO='git://git.evergreen-ils.org/Evergreen.git'
99     EVERGREEN_BRANCH='master'
100     echo OPENSRF_REPO=${OPENSRF_REPO}
101     echo OPENSRF_BRANCH=${OPENSRF_BRANCH}
102     echo EVERGREEN_REPO=${EVERGREEN_REPO}
103     echo EVERGREEN_BRANCH=${EVERGREEN_BRANCH}
104     OPENSRF_PREREQ_TARGET=debian-wheezy
105     EVERGREEN_PREREQ_TARGET=debian-wheezy
106     EVERGREEN_DB_PREREQ_TARGET=postgres-server-debian-wheezy
107     echo OPENSRF_PREREQ_TARGET=${OPENSRF_PREREQ_TARGET}
108     echo EVERGREEN_PREREQ_TARGET=${EVERGREEN_PREREQ_TARGET}
109     echo EVERGREEN_DB_PREREQ_TARGET=${EVERGREEN_DB_PREREQ_TARGET}
110
111     export NODEJS_VERSION='v8.11.4'
112     export NODEJS_BINDIR="node-$NODEJS_VERSION-linux-x64"
113     export NODEJS_TARBIN="$NODEJS_BINDIR.tar.xz"
114     export NODEJS_BINARY="https://nodejs.org/dist/$NODEJS_VERSION/$NODEJS_TARBIN"
115     echo "NODEJS_BINARY=$NODEJS_BINARY"
116     echo "NODEJS_VERSION=$NODEJS_VERSION"
117
118     echo End of intializing installer =~-._
119 }
120
121 function configure_timezone {
122     echo _.-~= configure timezone
123     date
124     # should be America/New_York
125     perl -e 'print "2\n\n104\n";' | dpkg-reconfigure -fteletype tzdata
126     echo End of configure timezone =~-._
127 }
128
129 function configure_cpan {
130     echo _.-~= configure CPAN
131     date
132     # -----------------------------------------------------------------------
133     # force CPAN to load by installing something that should already be installed
134     if [ $YES ]; then
135         yes | cpan Fcntl
136     else
137         cpan Fcntl
138     fi
139     echo Return Value = $?
140     # CPAN follow pre-reqs?
141     if [ ! "$(echo 'o conf prerequisites_policy' | cpan | grep follow)" ]; then
142     if [ $YES ]; then
143
144         echo "setting cpan prerequisites_policy to follow"
145         echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan
146
147     else
148
149         echo '
150
151 -----------------------------------------------------------------------
152 The install will go faster if CPAN is configured to automatically install 
153 prerequisites.  You can revert the action later with:
154
155 echo -e "o conf prerequisites_policy ask\n o conf commit" | cpan 
156 '
157         while true; do
158             echo -n 'Automatically install prereqs? [Y/n] ';
159             read X;
160             [ "$X" == 'n' -o "$X" == "N" ] && break;
161             if [ "$X" == 'y' -o "$X" == 'Y' ]; then
162                 echo -e "o conf prerequisites_policy follow\\n o conf commit" | cpan
163                 break;
164             fi;
165         done;
166     fi;
167     fi;
168     echo End of configure CPAN =~-._
169 }
170
171 function build_essentials {
172     echo _.-~= Installing some build essentials
173     date
174     # Install some essential tools
175     apt-get update \
176     && apt-get -yq dist-upgrade \
177     && apt-get -yq install build-essential automake git psmisc ntp rsyslog lsb-release unzip;
178     echo Return Value = $?
179
180     if [ $LIVETEST ]; then
181         cpan TAP::Parser::SourceHandler::pgTAP
182         echo Return Value = $?
183     fi;
184     echo End of Installing some build essentials  =~-._
185 }
186
187 function docs_builder_prereqs {
188     echo _.-~= Installing prereqs for building the documentation formats
189     date
190     # Install tools used for building the docs
191     apt-get -yq install asciidoc source-highlight fop;
192     echo Return Value = $?
193
194     echo End of Installing prereqs for building the documentation formats =~-._
195 }
196
197 function build_the_docs {
198     echo _.-~= Building the AsciiDoc output formats
199     date
200     # build HTML
201     su - opensrf sh -c 'cd /home/opensrf/Evergreen/docs/ ; asciidoc root.adoc ; echo Return Value = $?'
202     # build PDF
203     su - opensrf sh -c 'cd /home/opensrf/Evergreen/docs/ ; a2x --fop --fop-opts="-q" root.adoc ; echo Return Value = $?'
204     # build EPUB
205     su - opensrf sh -c 'cd /home/opensrf/Evergreen/docs/ ; a2x --no-xmllint --format epub root.adoc ; echo Return Value = $?'
206
207     echo End of Building the AsciiDoc output formats =~-._
208 }
209
210 function setting_up_opensrf_env {
211     echo _.-~= creating opensrf user and environment
212     date
213     # Create opensrf user and set up environment
214     if [ ! "$(grep ^opensrf: /etc/passwd)" ]; then
215         useradd -m -s /bin/bash opensrf
216         echo Return Value = $?
217         echo 'export PATH=/openils/bin:$PATH' >> /home/opensrf/.bashrc
218         echo 'export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH' >> /home/opensrf/.bashrc
219     fi;
220     echo end of creating opensrf user and environment =~-._
221 }
222
223 function cloning_git_repos {
224     echo _.-~= cloning git repositories
225     date
226     OSRF_COMMAND="
227     cd /home/opensrf;
228     git clone --depth 0 --branch $OPENSRF_BRANCH $OPENSRF_REPO OpenSRF;
229     git clone --depth 0 --branch $EVERGREEN_BRANCH $EVERGREEN_REPO Evergreen;
230     "
231     rm -rf /home/opensrf/Evergreen /home/opensrf/OpenSRF
232     su - opensrf sh -c "$OSRF_COMMAND";
233     echo Return Value = $?
234
235     # Show tips
236     cd /home/opensrf/OpenSRF/
237     echo 'Tip of OpenSRF:' `git log --format=oneline | head -1`
238     cd /home/opensrf/Evergreen/
239     echo 'Tip of Evergreen:' `git log --format=oneline | head -1`
240
241     echo End of cloning git repositories =~-._
242 }
243
244 function opensrf_prereqs {
245     echo _.-~= Installing OpenSRF pre-requisites
246     date
247     # Install pre-reqs
248     mkdir -p /usr/src/evergreen; 
249     cd /usr/src/evergreen;
250     if [ $YES ]; then
251         yes | make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET}
252     else
253         make -f /home/opensrf/OpenSRF/src/extras/Makefile.install ${OPENSRF_PREREQ_TARGET}
254     fi;
255     echo Return Value = $?
256     echo End of Installing OpenSRF pre-requisites =~-._
257 }
258
259 function evergreen_prereqs {
260     echo _.-~= Installing Evergreen pre-requisites
261     date
262     if [ $YES ]; then
263         yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET}
264     else
265         make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_PREREQ_TARGET}
266     fi;
267     echo Return Value = $?
268     echo End of Installing Evergreen pre-requisites =~-._
269 }
270
271 function evergreen_db_prereqs {
272     echo _.-~= Installing Evergreen database pre-requisites
273     date
274     if [ $YES ]; then
275         yes | make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET}
276     else
277         make -f /home/opensrf/Evergreen/Open-ILS/src/extras/Makefile.install ${EVERGREEN_DB_PREREQ_TARGET}
278     fi;
279     echo Return Value = $?
280     echo End of Installing Evergreen database pre-requisites =~-._
281 }
282
283 function setting_ldconfig_and_rsyslog_and_hosts_and_ejabberd {
284     echo _.-~= setting ld.so.conf and rsyslog and /etc/hosts and ejabberd
285     date
286     cp $BASE_DIR/evergreen.ld.conf /etc/ld.so.conf.d/
287     ldconfig;
288     echo Return Value = $?
289     # Configure rsyslog and restart
290     cp /home/opensrf/Evergreen/Open-ILS/examples/evergreen-rsyslog.conf /etc/rsyslog.d/evergreen.conf
291     /etc/init.d/rsyslog restart
292     echo Return Value = $?
293     if [ ! "$(grep 'public.localhost' /etc/hosts)" ]; then
294
295         if [ $YES ]; then
296             echo 'Adding public.localhost and private.localhost to /etc/hosts'
297             echo '127.0.1.2    public.localhost     public' >> /etc/hosts
298             echo '127.0.1.3    private.localhost    private' >> /etc/hosts
299         else
300
301         cat <<EOF
302
303     * Add these lines to /etc/hosts.
304
305     127.0.1.2   public.localhost    public
306     127.0.1.3   private.localhost   private
307
308 EOF
309         fi;
310
311     else
312         echo "INFO: /etc/hosts already has public.localhost line";
313     fi
314     echo Return Value = $?
315     # Patch Ejabberd and register users
316     if [ ! "$(grep 'public.localhost' /etc/ejabberd/ejabberd.cfg)" ]; then
317         cd /etc/ejabberd/
318         /etc/init.d/ejabberd stop;
319         killall beam epmd; # just in case
320         cp ejabberd.cfg /root/ejabberd.cfg.orig
321         patch -p0 < $BASE_DIR/ejabberd.EG.patch
322         chown ejabberd:ejabberd ejabberd.cfg
323         echo starting ejabberd after patching
324         date
325         /etc/init.d/ejabberd start
326         echo Return Value = $?
327         sleep 10;
328         ejabberdctl register router  private.localhost $JABBER_PASSWORD
329         echo Return Value = $?
330         ejabberdctl register opensrf private.localhost $JABBER_PASSWORD
331         echo Return Value = $?
332         ejabberdctl register router  public.localhost  $JABBER_PASSWORD
333         echo Return Value = $?
334         ejabberdctl register opensrf public.localhost  $JABBER_PASSWORD
335         echo Return Value = $?
336     fi;
337     echo End of setting ld.so.conf and rsyslog and /etc/hosts and ejabberd =~-._
338 }
339
340 function build_opensrf {
341     # Build and install OpenSRF
342     echo _.-~= Building OpenSRF
343     date
344     OSRF_COMMAND='
345     cd /home/opensrf/OpenSRF;
346     autoreconf -i;
347     ./configure --prefix=/openils --sysconfdir=/openils/conf;
348     make;'
349     su - opensrf sh -c "$OSRF_COMMAND"
350     echo Return Value = $?
351     echo End of Building OpenSRF =~-._
352 }
353
354 function test_opensrf_build {
355     echo _.-~= Running OpenSRF build tests
356     date
357     cd /home/opensrf/OpenSRF;
358     make check
359     echo Return Value = $?
360     echo End of OpenSRF build tests =~-._
361 }
362
363 function install_opensrf {
364     echo _.-~= Installing OpenSRF
365     date
366     make install
367     echo Return Value = $?
368     echo End of Installing OpenSRF =~-._
369 }
370
371 function build_evergreen {
372     echo _.-~= Building Evergreen
373     date
374     OSRF_COMMAND='
375     export PATH=/openils/bin:$PATH
376     cd /home/opensrf/Evergreen;
377     autoreconf -i;
378     ./configure --prefix=/openils --sysconfdir=/openils/conf;
379     make;
380     '
381     su - opensrf sh -c "$OSRF_COMMAND"
382     echo Return Value = $?
383     echo End of Building Evergreen =~-._
384 }
385
386 function test_evergreen_build {
387     echo _.-~= Running Evergreen build tests
388     date
389     cd /home/opensrf/Evergreen
390     make check
391     echo Return Value = $?
392     echo End of Evergreen build tests =~-._
393 }
394
395
396 # The evergreen browser client prereq installation and 
397 # build process is not baked into Evergreen proper (yet).  
398 # Run it as a standalone operation for now.
399 function test_and_build_eg_browser_client {
400     echo _.-~= Running Evergreen browser client build/test
401     cd /home/opensrf && pwd
402     wget -N $NODEJS_BINARY
403     tar xf $NODEJS_TARBIN
404     echo Return Value = $?
405     export PATH=$PATH:/home/opensrf/$NODEJS_BINDIR/bin
406     echo Return Value = $?
407     echo Running npm update
408     npm update
409     echo Return Value = $?
410     echo Running npm i npm@latest -g
411     npm i npm@latest -g
412     echo Return Value = $?
413     echo Running npm audit
414     npm audit
415     echo Return Value = $?
416     cd /home/opensrf/Evergreen/Open-ILS/web/js/ui/default/staff && pwd
417     echo Running npm install
418     npm install                 # fetch build depencies
419     echo Return Value = $?
420     echo Running npm run build
421     npm run build                 # copy into place; use build-prod for concatenation
422     echo Return Value = $?
423     echo Running npm test
424     npm run test                  # run JS unit tests
425     echo Return Value = $?
426     cd /home/opensrf/Evergreen/Open-ILS/src/eg2/ && pwd
427     echo Running npm install
428     npm install                 # fetch build depencies
429     echo Return Value = $?
430     echo Running ng build --prod
431     ng build --prod             # for ang6
432     echo Return Value = $?
433     echo Running npm test
434     npm run test                  # run JS unit tests
435     echo Return Value = $?
436     echo End of Evergreen browser client build/test =~-._
437 }
438
439 function install_evergreen {
440     echo _.-~= Installing Evergreen
441     date
442     cd /home/opensrf/Evergreen
443     make install
444     echo Return Value = $?
445
446     cp /openils/conf/opensrf.xml.example      /openils/conf/opensrf.xml
447     cp /openils/conf/opensrf_core.xml.example /openils/conf/opensrf_core.xml
448
449     # fetch and install Dojo
450     cd /tmp;
451     wget -N "http://download.dojotoolkit.org/release-$DOJO_VERSION/dojo-release-$DOJO_VERSION.tar.gz" \
452     || wget -N "http://evergreen-ils.org/~phasefx/download.dojotoolkit.org/dojo-release-$DOJO_VERSION.tar.gz"
453     tar -zxf dojo-release-$DOJO_VERSION.tar.gz;
454     cp -r dojo-release-$DOJO_VERSION/* /openils/var/web/js/dojo/;
455
456     # give it all to opensrf
457     chown -R opensrf:opensrf /openils
458
459     # copy srfsh config into place
460     cp /openils/conf/srfsh.xml.example /home/opensrf/.srfsh.xml;
461     chown opensrf:opensrf /home/opensrf/.srfsh.xml;
462     echo End of Installing Evergreen =~-._
463 }
464
465 function configure_database {
466     echo _.-~= configure database
467     date
468     if [ $YES ]; then
469         echo "Using password $PGPASSWORD for the $PGUSER database user."
470         echo -e "$PGPASSWORD\n$PGPASSWORD\n" | su - postgres sh -c "createuser -P -s $PGUSER;"
471     else
472         echo -e "\n\nPlease enter a password for the $PGUSER database user.\n  If you do not want to edit configs, use \"$PGPASSWORD\"\n"
473         su - postgres sh -c "createuser -P -s $PGUSER;"
474     fi;
475
476     # Apply the DB schema
477     cd /home/opensrf/Evergreen
478     perl Open-ILS/src/support-scripts/eg_db_config \
479         --create-database       \
480         --create-schema         \
481         --create-offline        \
482         --update-config $SAMPLEDATA \
483         --service all           \
484         --user $PGUSER          \
485         --password $PGPASSWORD  \
486         --hostname $PGHOST      \
487         --database $PGDATABASE  \
488         --admin-user $ADMIN_USER \
489         --admin-pass $ADMIN_PASS;
490     echo Return Value = $?
491
492     if [ $LIVETEST ]; then
493         PG_TAP_VER="0.97.0"
494         wget -N http://api.pgxn.org/dist/pgtap/$PG_TAP_VER/pgtap-$PG_TAP_VER.zip \
495         && unzip pgtap-$PG_TAP_VER.zip \
496         && cd pgtap-$PG_TAP_VER \
497         && make \
498         && make installcheck \
499         && make install
500         echo 'CREATE EXTENSION pgtap;' | su - postgres -c "psql evergreen"
501     fi;
502     echo configure database =~-._
503 }
504
505 function configure_apache {
506     echo _.-~= configure apache
507     date
508     /etc/init.d/apache2 stop
509     # Copy apache configs into place and create SSL cert
510     cd /home/opensrf/Evergreen/
511     cp Open-ILS/examples/apache/eg.conf       /etc/apache2/sites-available/
512     cp Open-ILS/examples/apache/eg_vhost.conf /etc/apache2/
513     cp Open-ILS/examples/apache/eg_startup    /etc/apache2/
514
515     mkdir -p /etc/apache2/ssl;
516     if [ ! -f /etc/apache2/ssl/server.key ] ; then
517         echo -e "\n\nConfiguring a new temporary SSL certificate....\n";
518         if [ $YES ]; then
519            yes "" | openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key
520         else
521            openssl req -new -x509 -days 365 -nodes -out /etc/apache2/ssl/server.crt -keyout /etc/apache2/ssl/server.key
522         fi;
523     else
524         echo -e "\nkeeping existing ssl/server.key file\n";
525     fi
526
527     a2enmod ssl  
528     echo Return Value = $?
529     a2enmod rewrite
530     echo Return Value = $?
531     a2enmod expires 
532     echo Return Value = $?
533     a2dissite 000-default
534     echo Return Value = $?
535     a2ensite eg.conf
536     echo Return Value = $?
537
538     echo Modifying APACHE_RUN_USER/APACHE_RUN_GROUP in /etc/apache2/envvars
539     sed -i 's/www-data/opensrf/g' /etc/apache2/envvars
540
541     echo Making sure /var/lock/apache2 is owned by opensrf
542     chown opensrf:opensrf /var/lock/apache2
543
544     echo Modifying KeepAliveTimeout in /etc/apache2/apache2.conf
545     sed -i 's/KeepAliveTimeout .*/KeepAliveTimeout 1/' /etc/apache2/apache2.conf
546
547     echo End of configure apache =~-._
548 }
549
550 function start_evergreen {
551     echo _.-~= Starting Evergreen
552     date
553     if [ $LIVETEST ]; then
554         rm /openils/var/log/*.log
555     fi
556
557     OSRF_COMMAND='
558     export LD_LIBRARY_PATH=/openils/lib:/usr/local/lib:/usr/local/lib/dbd:$LD_LIBRARY_PATH \
559     && export PATH=/openils/bin:$PATH \
560     && OSRF_HOSTNAME="dns_hack" /openils/bin/osrf_control --localhost --restart-all  && sleep 3 \
561     && /openils/bin/autogen.sh /openils/conf/opensrf_core.xml \
562     && echo Finis;
563     '
564     echo Starting services...
565     su - opensrf sh -c "$OSRF_COMMAND";
566     echo Return Value = $?
567
568     echo Restarting Apache
569     /etc/init.d/apache2 restart
570     echo Return Value = $?
571
572     echo End of Starting Evergreen =~-._
573 }
574
575 function test_evergreen_live {
576     # TODO: Eventually move these tests into a Make target within Evergreen
577     cd /home/opensrf/Evergreen
578     echo _.-~= Running pgTAP tests
579     date
580     su - postgres -c 'cd /home/opensrf/Evergreen ; pg_prove -vr -d evergreen Open-ILS/src/sql/Pg/t/ ; echo Return Value = $?'
581     echo End of pgTAP tests =~-._
582     echo _.-~= Running pgTAP live tests
583     date
584     su - postgres -c 'cd /home/opensrf/Evergreen ; pg_prove -vr -d evergreen Open-ILS/src/sql/Pg/live_t/ ; echo Return Value = $?'
585     echo End of pgTAP live tests =~-._
586     echo _.-~= Running settings-tester.pl
587     date
588     su - opensrf sh -c 'export PATH=/openils/bin:$PATH ; cd /home/opensrf/Evergreen/Open-ILS/src/support-scripts/ ; ./settings-tester.pl ; echo Return Value = $?'
589     echo End of settings-tester.pl output =~-._
590     echo _.-~= Running perl live tests
591     date
592     su - opensrf sh -c 'export PATH=/openils/bin:$PATH ; cd /home/opensrf/Evergreen/Open-ILS/src/perlmods/ ; make livecheck; echo Return Value = $?'
593     echo End of perl live tests =~-._
594     echo _.-~= Gathering log summary
595     date
596     echo ''
597     echo 'wc -l *.log:'
598     su - opensrf sh -c 'cd /openils/var/log/ ; wc -l *.log'
599     echo ''
600     echo 'du -sh *.log:'
601     su - opensrf sh -c 'cd /openils/var/log/ ; du -sh *.log'
602     echo ''
603     echo 'perl -ne ''if (/^\[.*?\] (.*?) \[/) { print "$1\n"; }'' osrfsys.log | sort | uniq -c | sort -k2:'
604     (cd /openils/var/log/ ; perl -ne 'if (/^\[.*?\] (.*?) \[/) { print "$1\n"; }' osrfsys.log | sort | uniq -c | sort -k2)
605     echo ''
606     echo End of log summary =~-._
607     cd /openils/var/log/
608     for x in *.log; do
609         echo _.-~= Log Output: $x
610         date
611         cat $x
612         echo End of $x =~-._
613     done
614     echo _.-~= Gathering system information
615     echo ''
616     date
617     echo ''
618     uname -a
619     echo 'select version();' | su - postgres -c 'psql -At'
620     echo ''
621     echo '/proc/meminfo:'
622     cat /proc/meminfo
623     echo ''
624     echo '/proc/cpuinfo:'
625     cat /proc/cpuinfo
626     echo ''
627     echo 'dpkg --list:'
628     dpkg --list
629     echo ''
630     echo 'cpan -l:'
631     cpan -l 2> /dev/null | sort
632     echo End of system information =~-._
633     date
634 }
635
636 my_init
637
638